efl_ui_format: add null checking codes for eina_strftime in _do_format_string function
authorTaehyub Kim <taehyub.kim@samsung.com>
Mon, 26 Aug 2019 05:50:44 +0000 (14:50 +0900)
committerHosang Kim <hosang12.kim@samsung.com>
Wed, 28 Aug 2019 04:49:03 +0000 (13:49 +0900)
Summary: efl_ui_format: add null checking codes for eina_strftime in _do_format_string function

Reviewers: kimcinoo

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9735

src/lib/elementary/efl_ui_format.c

index beb3945..98850e7 100644 (file)
@@ -136,11 +136,14 @@ _do_format_string(Efl_Ui_Format_Data *pd, Eina_Strbuf *str, const Eina_Value val
       case FORMAT_TYPE_TM:
       {
         struct tm v;
-        char *buf;
+        char *buf = NULL;
         eina_value_get(&value, &v);
         buf = eina_strftime(pd->format_string, &v);
-        eina_strbuf_append(str, buf);
-        free(buf);
+        if (buf)
+          {
+             eina_strbuf_append(str, buf);
+             free(buf);
+          }
         break;
       }
       default: