---
 drivers/mbmmodem/location-reporting.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/mbmmodem/location-reporting.c 
b/drivers/mbmmodem/location-reporting.c
index b671d71..24ff4b8 100644
--- a/drivers/mbmmodem/location-reporting.c
+++ b/drivers/mbmmodem/location-reporting.c
@@ -71,6 +71,7 @@ static void mbm_e2gpsctl_disable_cb(gboolean ok, GAtResult 
*result,
        }
 
        g_io_channel_unref(gd->data_channel);
+       gd->data_channel = NULL;
 
        CALLBACK_WITH_SUCCESS(cb, cbd->data);
 }
@@ -116,6 +117,7 @@ static GAtChat *mbm_create_data_chat(struct 
ofono_location_reporting *lr)
 
        if (chat == NULL) {
                g_io_channel_unref(gd->data_channel);
+               gd->data_channel = NULL;
 
                return NULL;
        }
@@ -158,6 +160,7 @@ static void mbm_e2gpsctl_enable_cb(gboolean ok, GAtResult 
*result,
 
        g_at_chat_unref(chat);
        g_io_channel_unref(gd->data_channel);
+       gd->data_channel = NULL;
 
 out:
        CALLBACK_WITH_FAILURE(cb, -1, cbd->data);
@@ -225,6 +228,9 @@ static void mbm_location_reporting_remove(struct 
ofono_location_reporting *lr)
 {
        struct gps_data *gd = ofono_location_reporting_get_data(lr);
 
+       if (gd->data_channel != NULL)
+               g_io_channel_unref(gd->data_channel);
+
        ofono_location_reporting_set_data(lr, NULL);
 
        g_at_chat_unref(gd->chat);
-- 
1.7.4.1

_______________________________________________
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono

Reply via email to