Commit bb65da7d by Sven Strickroth

Fix memory leak

Signed-off-by: Sven Strickroth <email@cs-ware.de>
parent 22f38253
...@@ -108,11 +108,11 @@ int git_regexp_match(const git_regexp *r, const char *string) ...@@ -108,11 +108,11 @@ int git_regexp_match(const git_regexp *r, const char *string)
data = pcre2_match_data_create(1, NULL); data = pcre2_match_data_create(1, NULL);
GIT_ERROR_CHECK_ALLOC(data); GIT_ERROR_CHECK_ALLOC(data);
if ((error = pcre2_match(*r, (const unsigned char *) string, strlen(string), error = pcre2_match(*r, (const unsigned char *) string, strlen(string), 0, 0, data, NULL);
0, 0, data, NULL)) < 0) pcre2_match_data_free(data);
if (error < 0)
return (error == PCRE2_ERROR_NOMATCH) ? GIT_ENOTFOUND : GIT_EINVALIDSPEC; return (error == PCRE2_ERROR_NOMATCH) ? GIT_ENOTFOUND : GIT_EINVALIDSPEC;
pcre2_match_data_free(data);
return 0; return 0;
} }
......
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