aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2018-12-12 14:47:38 +0200
committerSergey Poznyakoff <gray@gnu.org>2018-12-12 14:47:38 +0200
commit4f46a13f08c92b365469fd160415d5f0bf1dbf41 (patch)
tree51dd128b32535e3ff0f8d06b1560a6aca48a882b
parent7aeded7e40ca9e02403988c9da8a6fed0b7748c0 (diff)
downloadtallyman-4f46a13f08c92b365469fd160415d5f0bf1dbf41.tar.gz
tallyman-4f46a13f08c92b365469fd160415d5f0bf1dbf41.tar.bz2
Fix memory leak
* src/stevedore.c (http_log): Free allocated str.
-rw-r--r--src/stevedore.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/stevedore.c b/src/stevedore.c
index fd1eb1c..c39db5c 100644
--- a/src/stevedore.c
+++ b/src/stevedore.c
@@ -299,12 +299,13 @@ http_log(struct MHD_Connection *connection,
if (obj)
str = json_to_str(obj);
else
- str = "";
+ str = NULL;
info("%s %s - - %s \"%s %s\" \"%s\" %3d \"%s\" \"%s\"",
- host, ipstr, tbuf, method, url, str, status,
+ host, ipstr, tbuf, method, url, str ? str : "", status,
referer ? referer : "",
user_agent ? user_agent : "");
+ free(str);
free(ipstr);
}

Return to:

Send suggestions and report system problems to the System administrator.