From bdd02e2796855733bfdaa584cac612096c0c9c3b Mon Sep 17 00:00:00 2001 From: Jean-Philippe Orsini Date: Sun, 2 Nov 2014 17:26:40 +0100 Subject: [PATCH] fixed potential memory leak when failing to convert time to string which is unlikely. --- NEWS | 5 +++++ src/ptime.c | 10 ++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 079df21..9822120 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,11 @@ What's New ========== +v0.0.9 +------ + * fixed potention memory leak when failing to convert time to string + which is unlikely. + v0.0.8 ------ * fixed a critical gtk error when loading the glade file diff --git a/src/ptime.c b/src/ptime.c index 2e017fc..425e4bb 100644 --- a/src/ptime.c +++ b/src/ptime.c @@ -55,9 +55,11 @@ char *tm_to_str(const struct tm *tm) str = malloc(11); s = strftime(str, 11, "%Y/%m/%d", tm); - if (s) + if (s) { return str; - - log_err("Failed to convert time"); - return NULL; + } else { + log_err("Failed to convert time"); + free(str); + return NULL; + } } -- 2.7.4