pepper: Fix possible memory leak path 49/114349/1
authorHoyub Lee <hoyub.lee@samsung.com>
Mon, 13 Feb 2017 04:20:51 +0000 (13:20 +0900)
committerHoyub Lee <hoyub.lee@samsung.com>
Mon, 13 Feb 2017 05:41:28 +0000 (14:41 +0900)
Change-Id: I3df142212d2a8565b7e78c44fa80d9306bf83edf
Signed-off-by: Hoyub Lee <hoyub.lee@samsung.com>
src/lib/pepper/utils-log.c

index 80f03aa..94b523f 100644 (file)
@@ -56,8 +56,10 @@ pepper_print_timestamp(void)
        if (!brokendown_time)
                return fprintf(pepper_log_file, "failed to calloc for brokendown_time\n");
 
-       if (!localtime_r(&tv.tv_sec, brokendown_time))
+       if (!localtime_r(&tv.tv_sec, brokendown_time)) {
+               free(brokendown_time);
                return fprintf(pepper_log_file, "[(NULL)localtime] ");
+       }
 
        if (brokendown_time->tm_mday != cached_tm_mday) {
                strftime(string, sizeof string, "%Y-%m-%d %Z", brokendown_time);