memory leak fix - missed the string to free 61/49261/2
authorSoohye Shin <soohye.shin@samsung.com>
Mon, 12 Oct 2015 06:50:15 +0000 (15:50 +0900)
committerSoohye Shin <soohye.shin@samsung.com>
Mon, 12 Oct 2015 06:51:17 +0000 (15:51 +0900)
Change-Id: I1c507bbe9a3ce25db1decf65180ec398d96a69fa
Signed-off-by: Soohye Shin <soohye.shin@samsung.com>
src/data/data_home.c

index be234bc..f0cc1d6 100644 (file)
@@ -270,7 +270,6 @@ static Eina_List *_get_items(struct datamgr *dm)
 
 static void _notification_cb(void *data, notification_type_e type)
 {
-       char *noti = NULL;
        Eina_List *l;
        struct datamgr *dm;
        struct datamgr_item *di;
@@ -283,13 +282,15 @@ static void _notification_cb(void *data, notification_type_e type)
 
        dm = data;
 
-       snprintf(buf, sizeof(buf), "%d", utils_get_notification_count());
-       noti = strdup(buf);
-
-       viewmgr_update_view(VIEW_HOME, UPDATE_TYPE_NOTI, noti);
        EINA_LIST_FOREACH(dm->list, l, di) {
-               if (di->noti)
-                       di->subtitle = noti;
+               if (!di->noti)
+                       continue;
+
+               snprintf(buf, sizeof(buf), "%d",
+                               utils_get_notification_count());
+               viewmgr_update_view(VIEW_HOME, UPDATE_TYPE_NOTI, buf);
+               free(di->subtitle);
+               di->subtitle = strdup(buf);
        }
 }