fixed potential memory leak when failing to convert time to string which is unlikely.
authorJean-Philippe Orsini <jeanfi@gmail.com>
Sun, 2 Nov 2014 16:26:40 +0000 (17:26 +0100)
committerJean-Philippe Orsini <jeanfi@gmail.com>
Sun, 2 Nov 2014 16:26:40 +0000 (17:26 +0100)
NEWS
src/ptime.c

diff --git a/NEWS b/NEWS
index 079df21..9822120 100644 (file)
--- 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
index 2e017fc..425e4bb 100644 (file)
@@ -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;
+       }
 }