dbus: Do not free value that has been freed by gdbus API

gattlib-py-setup
Olivier Martin 2019-07-30 15:32:28 +02:00 committed by Olivier Martin
parent 3b495609ed
commit 6ace06d3c5
1 changed files with 6 additions and 4 deletions

View File

@ -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;
}