commit 250a1e1ad14cb751961035c1a4e9636f06c34985
parent 630d8ece05ff3c9c91e7325774b52f0f55b80962
Author: Joris Vink <joris@coders.se>
Date: Wed, 9 Apr 2014 14:35:14 +0200
Fix use after free
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/accesslog.c b/src/accesslog.c
@@ -127,9 +127,8 @@ kore_accesslog_wait(void)
}
len = write(dom->accesslog, buf, l);
- free(buf);
-
if (len == -1) {
+ free(buf);
kore_log(LOG_WARNING,
"kore_accesslog_wait(): write(): %s", errno_s);
return (KORE_RESULT_ERROR);
@@ -138,6 +137,7 @@ kore_accesslog_wait(void)
if (len != l)
kore_log(LOG_NOTICE, "accesslog: %s", buf);
+ free(buf);
return (KORE_RESULT_OK);
}