From 6ace06d3c5f535b4d490b3830f86936b61333db6 Mon Sep 17 00:00:00 2001 From: Olivier Martin Date: Tue, 30 Jul 2019 15:32:28 +0200 Subject: [PATCH] dbus: Do not free value that has been freed by gdbus API --- dbus/gattlib_char.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/dbus/gattlib_char.c b/dbus/gattlib_char.c index e9cde1e..416499d 100644 --- a/dbus/gattlib_char.c +++ b/dbus/gattlib_char.c @@ -396,12 +396,14 @@ static int write_char(struct dbus_characteristic *dbus_characteristic, const voi if (error != NULL) { fprintf(stderr, "Failed to write DBus GATT characteristic: %s\n", error->message); g_error_free(error); - ret = GATTLIB_ERROR_DBUS; - goto EXIT; + return GATTLIB_ERROR_DBUS; } -EXIT: - g_variant_unref(value); + // + // @note: No need to free `value` has it is freed by org_bluez_gatt_characteristic1_call_write_value_sync() + // See: https://developer.gnome.org/gio/stable/GDBusProxy.html#g-dbus-proxy-call + // + return ret; }