Fix memleak: free regex when parsing fails

fixes #2541
This commit is contained in:
Michael Stapelberg 2017-08-28 09:22:38 +02:00
parent f1e6d4ef2d
commit c4474adfd6
1 changed files with 1 additions and 0 deletions

View File

@ -38,6 +38,7 @@ struct regex *regex_new(const char *pattern) {
} }
ELOG("PCRE regular expression compilation failed at %d: %s\n", ELOG("PCRE regular expression compilation failed at %d: %s\n",
offset, error); offset, error);
regex_free(re);
return NULL; return NULL;
} }
re->extra = pcre_study(re->regex, 0, &error); re->extra = pcre_study(re->regex, 0, &error);