updated copyright
[ptask.git] / src / ptime.c
index 2e017fc..8efb5ff 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010-2013 jeanfi@gmail.com
+ * Copyright (C) 2010-2016 jeanfi@gmail.com
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
@@ -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;
+       }
 }