Fix the memory leak in GVariant use 14/117414/2 accepted/tizen/common/20170307.133933 accepted/tizen/ivi/20170307.102316 accepted/tizen/mobile/20170307.102237 accepted/tizen/tv/20170307.102247 accepted/tizen/unified/20170309.033459 accepted/tizen/wearable/20170307.102303 submit/tizen/20170307.054841 submit/tizen_unified/20170308.100408
authorJunjie Cheng <junjie.cheng@samsung.com>
Fri, 3 Mar 2017 09:31:52 +0000 (17:31 +0800)
committerJeesun Kim <iamjs.kim@samsung.com>
Tue, 7 Mar 2017 05:45:05 +0000 (14:45 +0900)
[Model]Tizen3.0
[BinType] AP
[Customer]N/A
[Issue#]N/A
[Request]N/A
[Occurrence Version]N/A
[Problem]N/A
[Cause & Measure]N/A
[Checking Method]N/A
[Team] PIMS
[Developer] Junjie Cheng
[Solution company] Samsung
[Change Type]N/A

Change-Id: I67651def7ec38c3fdf9cce256929b4e2007fb148

common/dbus/cal_dbus_helper.c

index 389f79b..c84eb68 100644 (file)
@@ -1723,6 +1723,8 @@ int cal_dbus_utils_gvariant_to_record(GVariant *arg_record_pack, calendar_record
                return CALENDAR_ERROR_INVALID_PARAMETER;
 
        _gvariant_to_record(type, arg_common, arg_record, out_record);
+       g_variant_unref(arg_common);
+       g_variant_unref(arg_record);
        return CALENDAR_ERROR_NONE;
 }
 
@@ -1744,14 +1746,19 @@ int cal_dbus_utils_gvariant_to_list(GVariant *arg_list_pack, calendar_list_h *ou
                        calendar_record_h record = NULL;
                        int ret = 0;
                        ret = cal_dbus_utils_gvariant_to_record(arg_record, &record);
-                       if (CALENDAR_ERROR_NONE != ret)
+                       if (CALENDAR_ERROR_NONE != ret) {
+                               g_variant_unref(arg_record);
                                break;
+                       }
 
                        calendar_list_add(l, record);
+                       g_variant_unref(arg_record);
                }
+               g_variant_iter_free(iter_value);
        }
 
        *out_list = l;
+       g_variant_unref(arg_list);
 
        return CALENDAR_ERROR_NONE;
 }