display: fix leak 05/235605/1
authorsanghyeok.oh <sanghyeok.oh@samsung.com>
Mon, 8 Jun 2020 04:33:12 +0000 (13:33 +0900)
committersanghyeok.oh <sanghyeok.oh@samsung.com>
Mon, 8 Jun 2020 04:33:21 +0000 (13:33 +0900)
Change-Id: I2cfcdb00e5381697958e490892285d89ae6798a8
Signed-off-by: sanghyeok.oh <sanghyeok.oh@samsung.com>
plugin/display/src/bm_display_plugin.c

index c62a81bf123344f2de446b71e0c9c1c8727ce3dc..ab5b321162c7fb202292f896e6e2f0e7ecd40e8b 100644 (file)
@@ -138,6 +138,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;
                        }
@@ -150,8 +152,9 @@ static bm_display_st *_variant_to_bds(GVariant *param)
 
                bds = (bm_display_st *)malloc(sizeof(bm_display_st));
                if (!bds) {
-                       _E("failed to allocate memory");
+                       g_variant_iter_free(sub_iter);
                        g_slist_free_full(atm_list, _atm_list_free);
+                       _E("failed to allocate memory");
                        goto err;
                }