Commit dfc4d477 authored by Geoff Simmons's avatar Geoff Simmons

Don't crash on regex object finalization if the contructor failed.

parent 82f84eaa
...@@ -338,9 +338,11 @@ vmod_regex__fini(struct vmod_re2_regex **rep) ...@@ -338,9 +338,11 @@ vmod_regex__fini(struct vmod_re2_regex **rep)
{ {
struct vmod_re2_regex *re; struct vmod_re2_regex *re;
if (rep == NULL || *rep == NULL)
return;
CHECK_OBJ(*rep, VMOD_RE2_REGEX_MAGIC);
re = *rep; re = *rep;
*rep = NULL; *rep = NULL;
CHECK_OBJ_NOTNULL(re, VMOD_RE2_REGEX_MAGIC);
vre2_fini(&re->vre2); vre2_fini(&re->vre2);
if (re->vcl_name != NULL) if (re->vcl_name != NULL)
free(re->vcl_name); free(re->vcl_name);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment