Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

notification memory leak....... #247

Open
gacmy opened this issue Mar 23, 2022 · 0 comments
Open

notification memory leak....... #247

gacmy opened this issue Mar 23, 2022 · 0 comments

Comments

@gacmy
Copy link

gacmy commented Mar 23, 2022

--------------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);
     }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant