[PATCH] huawei: avoid calling g_object_unref on NULL

Ben Chan benchan at chromium.org
Tue Jan 7 23:55:45 PST 2014


This patch prevents connect_3gpp_context_complete_and_free from calling
'g_object_unref (ctx->data)' when connect_3gpp finds no data port (i.e.
ctx->data is set to NULL).
---
 plugins/huawei/mm-broadband-bearer-huawei.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/plugins/huawei/mm-broadband-bearer-huawei.c b/plugins/huawei/mm-broadband-bearer-huawei.c
index b39839f..be84ff8 100644
--- a/plugins/huawei/mm-broadband-bearer-huawei.c
+++ b/plugins/huawei/mm-broadband-bearer-huawei.c
@@ -69,7 +69,8 @@ connect_3gpp_context_complete_and_free (Connect3gppContext *ctx)
     g_simple_async_result_complete_in_idle (ctx->result);
     g_object_unref (ctx->cancellable);
     g_object_unref (ctx->result);
-    g_object_unref (ctx->data);
+    if (ctx->data)
+        g_object_unref (ctx->data);
     g_object_unref (ctx->primary);
     g_object_unref (ctx->modem);
     g_object_unref (ctx->self);
-- 
1.8.5.1



More information about the ModemManager-devel mailing list