From 4720576933c96fa14b2f2809c703c3c5902a834a Mon Sep 17 00:00:00 2001 From: Hyuk Lee Date: Tue, 24 May 2016 09:05:30 +0900 Subject: [PATCH] Fix the svace issue - WGID:67836(double free) - WGID:81568, 81570(null after deref) - WGID:81578(memory leak) Change-Id: I774d485be0797636cf0f0a4b3801c43e20904793 Signed-off-by: Hyuk Lee --- ag-agent/bluetooth-ag-agent.c | 1 - map-agent/bluetooth_map_email.c | 25 ++++++++++++++----------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/ag-agent/bluetooth-ag-agent.c b/ag-agent/bluetooth-ag-agent.c index 74b80fd..16bd920 100755 --- a/ag-agent/bluetooth-ag-agent.c +++ b/ag-agent/bluetooth-ag-agent.c @@ -2265,7 +2265,6 @@ void _bt_ag_set_headset_state(bt_ag_info_t *hs, hs_state_t state) __bt_ag_stop_sco_server(hs); g_free(hs->remote_addr); - g_free(hs->slc); g_free(hs); break; diff --git a/map-agent/bluetooth_map_email.c b/map-agent/bluetooth_map_email.c index 90a8d65..2ce737e 100644 --- a/map-agent/bluetooth_map_email.c +++ b/map-agent/bluetooth_map_email.c @@ -186,13 +186,14 @@ static void __bt_email_subscription_callback(GDBusConnection *connection, } handle = _bt_add_id(mailid, BT_MAP_ID_EMAIL); - if (mailbox->mailbox_type == EMAIL_MAILBOX_TYPE_INBOX) { - _bt_mns_client_event_notify("NewMessage", handle, - "TELECOM/MSG/INBOX", "", - "EMAIL"); - } - if (mailbox) + if (mailbox) { + if (mailbox->mailbox_type == EMAIL_MAILBOX_TYPE_INBOX) { + _bt_mns_client_event_notify("NewMessage", handle, + "TELECOM/MSG/INBOX", "", + "EMAIL"); + } email_free_mailbox(&mailbox, 1); + } } else if (subtype == NOTI_MAIL_MOVE_FINISH) { /* Received values from Signal*/ @@ -281,10 +282,9 @@ static void __bt_email_subscription_callback(GDBusConnection *connection, mail_ids = g_list_next(mail_ids); } } - if (mailbox_to) - email_free_mailbox(&mailbox_to, 1); - if (mailbox_from) - email_free_mailbox(&mailbox_from, 1); + + email_free_mailbox(&mailbox_to, 1); + email_free_mailbox(&mailbox_from, 1); } } @@ -463,7 +463,10 @@ static message_info_t *__bt_email_info_get(email_mail_list_item_t *email_struct, email_info->recipient_name = g_strdup(mail_data->alias_recipient); } - email_info->recipient_addressing = g_strdup(mail_data->email_address_recipient); + if (mail_data->email_address_recipient) { + g_free(email_info->recipient_addressing); + email_info->recipient_addressing = g_strdup(mail_data->email_address_recipient); + } return email_info; } -- 2.7.4