forked from Telodendria/Telodendria
Fix some memory bugs.
This commit is contained in:
parent
5880cf3ea0
commit
e37e6f1bb8
3 changed files with 16 additions and 5 deletions
|
@ -38,12 +38,18 @@ homeserver changes and fixes:
|
|||
.Bl -bullet
|
||||
.It
|
||||
Fixed a memory leak that would occur when parsing an invalid
|
||||
JSON object failed.
|
||||
JSON object.
|
||||
.It
|
||||
Fixed an edge case where HTTP response headers were being
|
||||
sent before they were set properly, causing the server to
|
||||
report a status of 200 even when that wasn't the desired
|
||||
status.
|
||||
.It
|
||||
Fixed a few memory leaks in the HTTP parameter decoder that
|
||||
would occur in some edge cases.
|
||||
.It
|
||||
Fixed an "off-by-one" error in the HTTP server that
|
||||
prevented GET parameters from being parsed.
|
||||
.El
|
||||
.Pp
|
||||
Other changes and fixes included in this release:
|
||||
|
|
11
src/Http.c
11
src/Http.c
|
@ -440,7 +440,7 @@ HttpParamDecode(char *in)
|
|||
if (!decKey)
|
||||
{
|
||||
/* Decoding error */
|
||||
Free(params);
|
||||
HashMapFree(params);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -471,11 +471,16 @@ HttpParamDecode(char *in)
|
|||
if (!decVal)
|
||||
{
|
||||
/* Decoding error */
|
||||
Free(params);
|
||||
HashMapFree(params);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
HashMapSet(params, decKey, decVal);
|
||||
buf = HashMapSet(params, decKey, decVal);
|
||||
if (buf)
|
||||
{
|
||||
Free(buf);
|
||||
Free(decKey);
|
||||
}
|
||||
|
||||
if (*in == '&')
|
||||
{
|
||||
|
|
|
@ -561,7 +561,7 @@ HttpServerWorkerThread(void *args)
|
|||
}
|
||||
|
||||
requestPath[i] = '\0';
|
||||
requestParams = HttpParamDecode(requestPath + i);
|
||||
requestParams = HttpParamDecode(requestPath + i + 1);
|
||||
|
||||
context = HttpServerContextCreate(requestMethod, requestPath, requestParams, fp);
|
||||
if (!context)
|
||||
|
|
Loading…
Reference in a new issue