Fix memory leak and reuse allocated memory in window list 67/36567/1
authorSuchang Woo <suchang.woo@samsung.com>
Tue, 10 Mar 2015 06:37:30 +0000 (15:37 +0900)
committerSuchang Woo <suchang.woo@samsung.com>
Tue, 10 Mar 2015 06:39:27 +0000 (15:39 +0900)
Signed-off-by: Suchang Woo <suchang.woo@samsung.com>
Change-Id: Ifc3ef9cb161d711829b819cfa8d950831faebb42

src/appcore-efl.c

index 1d04ee5..2d5c97b 100644 (file)
@@ -167,7 +167,7 @@ static int WIN_COMP(gconstpointer data1, gconstpointer data2)
        return (int)((a->win)-(b->win));
 }
 
-GSList *g_winnode_list = NULL;
+static GSList *g_winnode_list;
 
 #if defined(MEMORY_FLUSH_ACTIVATE)
 static Eina_Bool __appcore_memory_flush_cb(void *data)
@@ -402,7 +402,7 @@ static bool __delete_win(unsigned int win)
                return 0;
        }
 
-       g_winnode_list = g_slist_remove_link(g_winnode_list, f);
+       g_winnode_list = g_slist_delete_link(g_winnode_list, f);
 
        free(f->data);
 
@@ -431,17 +431,12 @@ static bool __update_win(unsigned int win, bool bfobscured)
 
        g_winnode_list = g_slist_remove_link(g_winnode_list, f);
 
-       free(f->data);
-
-       t = calloc(1, sizeof(struct win_node));
-       if (t == NULL)
-               return FALSE;
-
+       t = f->data;
        t->win = win;
        t->bfobscured = bfobscured;
 
-       g_winnode_list = g_slist_append(g_winnode_list, t);
-       
+       g_winnode_list = g_slist_concat(g_winnode_list, f);
+
        return TRUE;
 
 }