From: sinikang Date: Tue, 6 Dec 2016 01:56:59 +0000 (+0900) Subject: [TSAM-10592] Fix memory leakage on sat noti handling X-Git-Tag: submit/tizen/20161206.223808^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1b03fa5596e459bc0a1ce8dcc2f77f2609c2fe92;p=platform%2Fcore%2Ftelephony%2Ftel-plugin-dbus_tapi.git [TSAM-10592] Fix memory leakage on sat noti handling Change-Id: I3005cceae3c8ceaf5f435dd96e7315e88b2de1ce --- diff --git a/packaging/tel-plugin-dbus_tapi.spec b/packaging/tel-plugin-dbus_tapi.spec index 8fa6388..5f490ac 100644 --- a/packaging/tel-plugin-dbus_tapi.spec +++ b/packaging/tel-plugin-dbus_tapi.spec @@ -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} diff --git a/src/dtapi_sat_manager.c b/src/dtapi_sat_manager.c index ddc139c..026a0f6 100644 --- a/src/dtapi_sat_manager.c +++ b/src/dtapi_sat_manager.c @@ -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;