From 948e3dec1c24d098f5b33c1e53c63b3f5ef132d8 Mon Sep 17 00:00:00 2001 From: Syam Sidhardhan Date: Thu, 15 Jun 2017 19:52:34 +0530 Subject: common: Fix memory leak We have to free the allocated memory. Change-Id: I040d3e0d57fa7967a5e4e3f456ec936b9f1f2ba2 Signed-off-by: Syam Sidhardhan --- src/bluetooth-common.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/bluetooth-common.c') diff --git a/src/bluetooth-common.c b/src/bluetooth-common.c index 081b1c1..2ea0c38 100644 --- a/src/bluetooth-common.c +++ b/src/bluetooth-common.c @@ -1570,11 +1570,12 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us void *user_data = data->user_data; free(data); - bt_map_client_message_s* res = malloc(sizeof(*res)); + bt_map_client_message_s *res = g_malloc0(sizeof(bt_map_client_message_s)); res->file_path = target_file; ((bt_map_client_get_message_cb)bt_event_slot_container[event_index].callback)( param->result, res, user_data); + g_free(res); break; case BLUETOOTH_EVENT_MAP_PUSH_MESSAGE_COMPLETE: @@ -2467,6 +2468,8 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us (_bt_get_error_code(param->result), (bt_device_att_mtu_info_s *)mtu_info, bt_event_slot_container[event_index].user_data); + g_free(mtu_info); + break; } case BLUETOOTH_EVENT_LE_DATA_LENGTH_CHANGED: -- cgit v1.2.3