log-hander: Fix leak of rotate_filename in cleanup path Running `obmc-console-server` under valgrind yields: ``` ==259265== 34 bytes in 1 blocks are definitely lost in loss record 1 of 1 ==259265== at 0x48407B4: malloc (vg_replace_malloc.c:381) ==259265== by 0x49BC427: __vasprintf_internal (vasprintf.c:71) ==259265== by 0x498FBD5: asprintf (asprintf.c:31) ==259265== by 0x10F2EF: log_init (log-handler.c:189) ==259265== by 0x10EBEB: handlers_init (console-server.c:564) ==259265== by 0x10EBEB: main (console-server.c:1000) ``` Free rotate_filename to avoid the leak. Change-Id: Ib403d50d47b5d266bab415944cbae93582ecdb65 Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
diff --git a/log-handler.c b/log-handler.c index 4109d8b..b77dd82 100644 --- a/log-handler.c +++ b/log-handler.c
@@ -202,6 +202,7 @@ return &lh->handler; err_free: + free(lh->rotate_filename); free(lh->log_filename); free(lh); return NULL;