Compare commits

...

8 commits

3 changed files with 10 additions and 4 deletions

View file

@ -196,7 +196,7 @@ HttpRouterRoute(HttpRouter * router, char *path, void *args, void **ret)
char *pathPart;
char *tmp;
HttpRouteFunc *exec = NULL;
Array *matches;
Array *matches = NULL;
size_t i;
int retval;
@ -254,14 +254,18 @@ HttpRouterRoute(HttpRouter * router, char *path, void *args, void **ret)
{
/* pmatch[0] is the whole string, not the first
* subexpression */
char * substr;
regmatch_t cpmatch;
for (i = 1; i < REG_MAX_SUB; i++)
{
cpmatch = pmatch[i];
substr = StrSubstr(pathPart, cpmatch.rm_so, cpmatch.rm_eo);
if (pmatch[i].rm_so == -1)
{
break;
}
ArrayAdd(matches, StrSubstr(pathPart, pmatch[i].rm_so, pmatch[i].rm_eo));
ArrayAdd(matches, substr);
}
}
}

View file

@ -147,7 +147,6 @@ StrSubstr(const char *inStr, size_t start, size_t end)
}
len = end - start;
outStr = Malloc(len + 1);
if (!outStr)
{

View file

@ -172,7 +172,10 @@ ROUTE_IMPL(RouteUserProfile, path, argp)
}
finish:
ConfigUnlock(config);
Free(username);
/* Username is handled by the router, freeing it *will* cause issues
* (see #33). I honestly don't know how it didn't come to bite us sooner.
Free(username); */
Free(entry);
UserIdFree(userId);
UserUnlock(user);