[TSAM-10592] Fix memory leakage on sat noti handling 56/102456/3 accepted/tizen/common/20161207.184224 accepted/tizen/ivi/20161207.031139 accepted/tizen/mobile/20161207.031045 accepted/tizen/tv/20161207.031102 accepted/tizen/wearable/20161207.031120 submit/tizen/20161206.223808
authorsinikang <sinikang@samsung.com>
Tue, 6 Dec 2016 01:56:59 +0000 (10:56 +0900)
committersinikang <sinikang@samsung.com>
Tue, 6 Dec 2016 02:20:13 +0000 (11:20 +0900)
Change-Id: I3005cceae3c8ceaf5f435dd96e7315e88b2de1ce

packaging/tel-plugin-dbus_tapi.spec
src/dtapi_sat_manager.c

index 8fa6388c836e59e8a13d2c4a1cd3d7fefe24140c..5f490ac851ee7e6cbc2926d31a402e78819ddc39 100644 (file)
@@ -1,6 +1,6 @@
 %define major 0
 %define minor 3
-%define patchlevel 74
+%define patchlevel 75
 
 Name:           tel-plugin-dbus_tapi
 Version:        %{major}.%{minor}.%{patchlevel}
index ddc139c99c4d1f6f67af294cb3ec3d110794c8c2..026a0f65bdf1275c1d29ab61c6c52938443b7b43 100644 (file)
@@ -1657,6 +1657,12 @@ GVariant* sat_manager_setup_event_list_noti(struct custom_data *ctx, const char
                return NULL;
        }
 
+       /*Move from 1688 lines to here, Previously, In case of failing memory allocation of tr, event_list was not freed.*/
+       /* send TR - does not need from application's response */
+       tr = (struct treq_sat_terminal_rsp_data *)calloc(1, sizeof(struct treq_sat_terminal_rsp_data));
+       if (!tr)
+               return NULL;
+
        /* event cnt */
        event_cnt = event_list_tlv->event_list.event_list_cnt;
        dbg("event cnt(%d)", event_cnt);
@@ -1682,10 +1688,6 @@ GVariant* sat_manager_setup_event_list_noti(struct custom_data *ctx, const char
 
                event_list = g_variant_new("(yv)", event_cnt, evt_list);
        }
-       /* send TR - does not need from application's response */
-       tr = (struct treq_sat_terminal_rsp_data *)calloc(1, sizeof(struct treq_sat_terminal_rsp_data));
-       if (!tr)
-               return NULL;
 
        tr->cmd_number = event_list_tlv->command_detail.cmd_num;
        tr->cmd_type = event_list_tlv->command_detail.cmd_type;
@@ -2661,8 +2663,6 @@ GVariant* sat_manager_provide_local_info_noti(struct custom_data *ctx, const cha
                return NULL;
        }
 
-       provide_info = g_variant_new("(i)", info_type);
-
        /* send TR - does not need from application's response */
        tr = (struct treq_sat_terminal_rsp_data *)calloc(1, sizeof(struct treq_sat_terminal_rsp_data));
        if (!tr)
@@ -2677,6 +2677,9 @@ GVariant* sat_manager_provide_local_info_noti(struct custom_data *ctx, const cha
 
        info_type = provide_local_info_tlv->command_detail.cmd_qualifier.provide_local_info.provide_local_info;
 
+       /*Move from 2664 line to here. Previously, In case of failing memory allocation of tr, provide_info was not freed.*/
+       provide_info = g_variant_new("(i)", info_type);
+
        switch (info_type) {
        case LOCAL_INFO_DATE_TIME_AND_TIMEZONE:{
                int err = 0; int gmt = 0, n_flg = 0;