From 7bf0c58d5875120748b8def662b560d7db5e392d Mon Sep 17 00:00:00 2001 From: INSUN PYO Date: Thu, 26 Sep 2019 11:32:37 +0900 Subject: [PATCH] Refactoring error handling Change-Id: Ia1d1a2eb9c50c3c1e72f86101e2af5119f744ee0 --- src/common/storage-helper.c | 8 +++----- src/heart/heart-memory.c | 5 ++--- src/memory/vmpressure-lowmem-handler.c | 1 - 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/common/storage-helper.c b/src/common/storage-helper.c index fdea05c..776acfe 100644 --- a/src/common/storage-helper.c +++ b/src/common/storage-helper.c @@ -168,13 +168,11 @@ resourced_ret_c storage_get_size(int type, struct storage_size *size) _E("Failed to get internal storage size"); goto fail; } - goto success; -fail: g_slist_free_full(paths, free); - return RESOURCED_ERROR_FAIL; + return RESOURCED_ERROR_NONE; -success: +fail: g_slist_free_full(paths, free); - return RESOURCED_ERROR_NONE; + return RESOURCED_ERROR_FAIL; } diff --git a/src/heart/heart-memory.c b/src/heart/heart-memory.c index 3b7aae2..893266b 100644 --- a/src/heart/heart-memory.c +++ b/src/heart/heart-memory.c @@ -106,9 +106,8 @@ static void heart_memory_free_value(gpointer value) { struct heart_memory_table * table = (struct heart_memory_table *)value; - if (!table) - return; - free(table); + if (table) + free(table); } static int heart_memory_read_length(char *buf, int count) diff --git a/src/memory/vmpressure-lowmem-handler.c b/src/memory/vmpressure-lowmem-handler.c index 6fa5f71..64b4c75 100644 --- a/src/memory/vmpressure-lowmem-handler.c +++ b/src/memory/vmpressure-lowmem-handler.c @@ -885,7 +885,6 @@ done: if (status == LOWMEM_RECLAIM_DONE) request_helper_worker(CLEAR_LOGS, MEMPS_LOG_PATH, clear_logs, NULL); ctl->status = status; - return; } static void *lowmem_reclaim_worker(void *arg) -- 2.7.4