gattlib
gattlib copied to clipboard
notification memory leak.......
--------------file: gattlib_notification.c --------------method: static gboolean on_handle_characteristic_property_change( OrgBluezGattCharacteristic1 *object, GVariant *arg_changed_properties, const gchar *const *arg_invalidated_properties, gpointer user_data)
while(g_variant_iter_loop (iter, "{&sv}", &key, &value)){ ..... g_variant_unref(value); }
g_variant_iter_loop awalys memory 264kb increasing
I changed:
while (g_variant_iter_next(iter, "{sv}", &key, &value)) { //GATTLIB_LOG(GATTLIB_DEBUG, "on_handle_characteristic_property_change: %s:%s", //> > key, g_variant_print(value, TRUE)); GATTLIB_LOG(GATTLIB_DEBUG, "haha while"); if (strcmp(key, "Value") == 0) { uuid_t uuid; size_t data_length; const uint8_t* data = g_variant_get_fixed_array(value, &data_length, sizeof(guchar));
gattlib_string_to_uuid(
org_bluez_gatt_characteristic1_get_uuid(object),
MAX_LEN_UUID_STR + 1,
&uuid);
gattlib_call_notification_handler(&connection->notification,
&uuid, data, data_length);
}
g_free(key);
g_variant_unref(value);
}