From: Unsung Lee Date: Mon, 13 Jan 2025 05:19:09 +0000 (+0900) Subject: cleanup_config: Free all member before freeing structure X-Git-Tag: accepted/tizen/9.0/unified/20250118.074100^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=49d30951ced425c1fa5ca8714f32b78860783963;p=platform%2Fcore%2Fsystem%2Fstoraged.git cleanup_config: Free all member before freeing structure Free all members of cleanup_config before freeing this structure. Previously, the structure is freed at error situation without freeing the member. Change-Id: Ib879efc6ccc2997901a5496b8510ce9cbfa804e2 Signed-off-by: Unsung Lee --- diff --git a/src/storage/cleanup_config.c b/src/storage/cleanup_config.c index 115c680..bf84f76 100644 --- a/src/storage/cleanup_config.c +++ b/src/storage/cleanup_config.c @@ -280,6 +280,7 @@ static GList *parsing_json_array_object_to_list(struct json_object *array, int * memset(item, '\0', item_size); if (add_config_item(json_object_get(obj), item) != 0) { + free_config_item(item); RESULT(ret, -EINVAL); goto cleanup; } @@ -288,9 +289,6 @@ static GList *parsing_json_array_object_to_list(struct json_object *array, int * RESULT(ret, 0); return list; cleanup: - if (item) - free(item); - g_list_free_full(list, free_config_item); return NULL; }