forked from lda/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
|
.Bl -bullet
|
||||||
.It
|
.It
|
||||||
Fixed a memory leak that would occur when parsing an invalid
|
Fixed a memory leak that would occur when parsing an invalid
|
||||||
JSON object failed.
|
JSON object.
|
||||||
.It
|
.It
|
||||||
Fixed an edge case where HTTP response headers were being
|
Fixed an edge case where HTTP response headers were being
|
||||||
sent before they were set properly, causing the server to
|
sent before they were set properly, causing the server to
|
||||||
report a status of 200 even when that wasn't the desired
|
report a status of 200 even when that wasn't the desired
|
||||||
status.
|
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
|
.El
|
||||||
.Pp
|
.Pp
|
||||||
Other changes and fixes included in this release:
|
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)
|
if (!decKey)
|
||||||
{
|
{
|
||||||
/* Decoding error */
|
/* Decoding error */
|
||||||
Free(params);
|
HashMapFree(params);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -471,11 +471,16 @@ HttpParamDecode(char *in)
|
||||||
if (!decVal)
|
if (!decVal)
|
||||||
{
|
{
|
||||||
/* Decoding error */
|
/* Decoding error */
|
||||||
Free(params);
|
HashMapFree(params);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
HashMapSet(params, decKey, decVal);
|
buf = HashMapSet(params, decKey, decVal);
|
||||||
|
if (buf)
|
||||||
|
{
|
||||||
|
Free(buf);
|
||||||
|
Free(decKey);
|
||||||
|
}
|
||||||
|
|
||||||
if (*in == '&')
|
if (*in == '&')
|
||||||
{
|
{
|
||||||
|
|
|
@ -561,7 +561,7 @@ HttpServerWorkerThread(void *args)
|
||||||
}
|
}
|
||||||
|
|
||||||
requestPath[i] = '\0';
|
requestPath[i] = '\0';
|
||||||
requestParams = HttpParamDecode(requestPath + i);
|
requestParams = HttpParamDecode(requestPath + i + 1);
|
||||||
|
|
||||||
context = HttpServerContextCreate(requestMethod, requestPath, requestParams, fp);
|
context = HttpServerContextCreate(requestMethod, requestPath, requestParams, fp);
|
||||||
if (!context)
|
if (!context)
|
||||||
|
|
Loading…
Reference in a new issue