Fix crash with g_variant_unref
authorJiwan Kim <ji-wan.kim@samsung.com>
Wed, 8 Feb 2017 05:56:00 +0000 (14:56 +0900)
committersaerome.kim <saerome.kim@samsung.com>
Thu, 11 May 2017 09:07:20 +0000 (18:07 +0900)
- With 'enable' method, g_dbus_proxy_call_sync() returns GVariant
  and g_variant_get() deconstructs that GVariant instance.
- It causes below error and sometimes crashes.
  [g_variant_unref: assertion 'value != NULL' failed]
- Testing with another method, issue was not found with g_variant_unref()
- Patch newly uploaded due to merge conflict.
  (Previous patch : http://165.213.149.170/gerrit/#/c/151298/)

Change-Id: I4c8b7aadcd96a6e5b86f6136e85a1e7ed48588ae
Signed-off-by: Jiwan Kim <ji-wan.kim@samsung.com>
lib/zbl-dbus.c

index d76a776cc97c7c723ca6f9849d52ebf3567320d0..9cc26f2c613fd106c161d6d341eb3f39bb6c652e 100644 (file)
@@ -2926,7 +2926,8 @@ int zbl_enable(zigbee_h handle, zb_event_cb event_handler)
 
        g_variant_get(variant, "(ib)", &result, &enabled);
        DBG("ret = [0x%x]", result);
-       g_variant_unref(variant);
+       if(variant)
+               g_variant_unref(variant);
 
        return result;
 }