Fix memory leak 01/229901/1
authorINSUN PYO <insun.pyo@samsung.com>
Mon, 6 Apr 2020 09:59:14 +0000 (18:59 +0900)
committerINSUN PYO <insun.pyo@samsung.com>
Mon, 6 Apr 2020 09:59:32 +0000 (18:59 +0900)
Change-Id: Ie6867273e859f2b8bf107d39afa62fad2cc19097

src/auto-test/battery-monitor-test.c

index 6493648..3b6c1a7 100644 (file)
@@ -143,6 +143,8 @@ static bm_display_st *_variant_to_bds(GVariant *param)
                while (g_variant_iter_loop(sub_iter, "(su)", &app_id, &app_time)) {
                        atm = (app_time_map_st1 *)malloc(sizeof(app_time_map_st1));
                        if (!atm) {
+                               g_free(app_id);
+                               g_variant_iter_free(sub_iter);
                                _E("failed to allocate memory");
                                goto err;
                        }
@@ -157,6 +159,7 @@ static bm_display_st *_variant_to_bds(GVariant *param)
                if (!bds) {
                        _E("failed to allocate memory");
                        g_slist_free_full(atm_list, _atm_list_free);
+                       g_variant_iter_free(sub_iter);
                        goto err;
                }