Merge pull request 'Fix potential double-free issue in Cytoplasm' (#22) from lda/Cytoplasm:fix-router-issue into master

Reviewed-on: Telodendria/Cytoplasm#22
This commit is contained in:
Jordan Bancino 2024-01-04 19:32:57 -05:00
commit d7da8e0a54

View file

@ -237,7 +237,6 @@ HttpRouterRoute(HttpRouter * router, char *path, void *args, void **ret)
{ {
if (regexec(&val->regex, pathPart, REG_MAX_SUB, pmatch, 0) == 0) if (regexec(&val->regex, pathPart, REG_MAX_SUB, pmatch, 0) == 0)
{ {
Free(pathPart);
break; break;
} }
@ -268,7 +267,6 @@ HttpRouterRoute(HttpRouter * router, char *path, void *args, void **ret)
substr = StrSubstr(pathPart, cpmatch.rm_so, cpmatch.rm_eo); substr = StrSubstr(pathPart, cpmatch.rm_so, cpmatch.rm_eo);
if (pmatch[i].rm_so == -1) if (pmatch[i].rm_so == -1)
{ {
Free(pathPart);
break; break;
} }