Fix memory leak 38/217438/1 accepted/tizen_5.5_unified accepted/tizen_5.5_unified_wearable_hotfix tizen_5.5_tv tizen_5.5_wearable_hotfix accepted/tizen/5.5/unified/20191112.124802 accepted/tizen/5.5/unified/wearable/hotfix/20201027.112834 submit/tizen_5.5/20191111.234009 submit/tizen_5.5_wearable_hotfix/20201026.184304
authorINSUN PYO <insun.pyo@samsung.com>
Tue, 24 Sep 2019 04:35:59 +0000 (13:35 +0900)
committerINSUN PYO <insun.pyo@samsung.com>
Mon, 11 Nov 2019 23:37:27 +0000 (23:37 +0000)
Change-Id: Ifbe1055fd4e606ead7df3a4d4d54fba8fcdf8e6f
Signed-off-by: INSUN PYO <insun.pyo@samsung.com>
(cherry picked from commit e36002b66edaf3e100b2cdaa0016218bedac1a5f)

src/memory/memory-killer.c
src/proc-usage/proc-usage-application.c

index 43834c44650b20eb13214663b20afafe16f4af78..3e954c297c8157a8e886eaf4ac77beac4867750e 100644 (file)
@@ -252,7 +252,7 @@ retain_memory:
        candidates = g_slist_sort(candidates, memory_killer_compare_func);
 
        _I("Low memory. Start to retain memory");
-       G_SLIST_FOREACH_WITH_REMOVE(candidates, candidate) {
+       G_SLIST_FOREACH(candidates, candidate) {
                g_assert(candidate);
 
                if (g_hash_table_contains(memory_killer_whitelist, candidate->basename))
@@ -286,7 +286,7 @@ retain_memory:
                        break;
                }
        }
-       g_slist_free(candidates);
+       g_slist_free_full(candidates, g_free);
        candidates = NULL;
 
        if (range == MEMORY_KILLER_RANGE_ONLY_APP && need_to_retain > 0) {
index 16a30d27afcf995ac087f290a35a10c91b76a9a4..105a7d396eb848df51ed758d1f8861efff428f6a 100644 (file)
@@ -130,7 +130,7 @@ GVariant *proc_usage_application_get_all_memory_usages(void)
 
        g_variant_builder_init(&builder, G_VARIANT_TYPE("a(su)"));
 
-       G_SLIST_FOREACH_WITH_REMOVE(applist, app) {
+       G_SLIST_FOREACH(applist, app) {
                g_assert(app);
 
                /* Ignore invalid app */
@@ -151,7 +151,7 @@ GVariant *proc_usage_application_get_all_memory_usages(void)
                g_assert(appusage);
                g_variant_builder_add_value(&builder, appusage);
        }
-       g_slist_free(applist);
+       g_slist_free_full(applist, g_free);
 
        return g_variant_new("(a(su))", &builder);
 }
@@ -192,7 +192,7 @@ GVariant *proc_usage_application_get_all_cpu_usages(void)
 
        g_variant_builder_init(&builder, G_VARIANT_TYPE("a(su)"));
 
-       G_SLIST_FOREACH_WITH_REMOVE(applist, app) {
+       G_SLIST_FOREACH(applist, app) {
                g_assert(app);
 
                /* Ignore invalid app */
@@ -221,7 +221,7 @@ GVariant *proc_usage_application_get_all_cpu_usages(void)
 
                g_variant_builder_add_value(&builder, appusage);
        }
-       g_slist_free(applist);
+       g_slist_free_full(applist, g_free);
 
        return g_variant_new("(a(su))", &builder);
 }