Now that we have a function that takes care of free'ing that structure we should use it. --- plugins/hfp_hf_bluez4.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/plugins/hfp_hf_bluez4.c b/plugins/hfp_hf_bluez4.c index b0aa1aa..ca73eaa 100644 --- a/plugins/hfp_hf_bluez4.c +++ b/plugins/hfp_hf_bluez4.c @@ -109,8 +109,10 @@ static void slc_failed(gpointer userdata) ofono_error("Service level connection failed"); ofono_modem_set_powered(modem, FALSE); - g_at_chat_unref(data->info->chat); - data->info->chat = NULL; + if (data->info) { + hfp_slc_info_free(data->info); + data->info = NULL; + } } static void hfp_disconnected_cb(gpointer user_data) @@ -120,8 +122,10 @@ static void hfp_disconnected_cb(gpointer user_data) ofono_modem_set_powered(modem, FALSE); - g_at_chat_unref(data->info->chat); - data->info->chat = NULL; + if (data->info) { + hfp_slc_info_free(data->info); + data->info = NULL; + } } /* either oFono or Phone could request SLC connection */ @@ -463,8 +467,10 @@ static int hfp_disable(struct ofono_modem *modem) DBG("%p", modem); - g_at_chat_unref(data->info->chat); - data->info->chat = NULL; + if (data->info) { + hfp_slc_info_free(data->info); + data->info = NULL; + } if (data->agent_registered) { status = bluetooth_send_with_reply(data->handsfree_path, -- 1.8.1.1