From: Jean-Philippe Orsini Date: Sun, 2 Nov 2014 16:26:40 +0000 (+0100) Subject: fixed potential memory leak when failing to convert time to string which is unlikely. X-Git-Tag: v0.0.9~11 X-Git-Url: https://git.wpitchoune.net/gitweb/?p=ptask.git;a=commitdiff_plain;h=bdd02e2796855733bfdaa584cac612096c0c9c3b fixed potential memory leak when failing to convert time to string which is unlikely. --- 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; + } }