Open chenbinn opened 3 years ago
I would strongly recommend merging this commit. It fixes a really annoying 'memory freeing' bug.
Hi @oliviermartin, would you be able to merge this pull request, which fixes a big memory leak, please? It's enough to run gattlib_connect() and gattlib_disconnect() in a loop, to leak over 8MB in every iteration. Such leak makes it impossible to use the library for any long-running apps. Thanks.
There is an additional memory leak, not covered by this pull request, which needs to be fixed. When gattlib_connect() is called with adapter=NULL, and something fails in the function (e.g. device fails to connect), the default adapter is not being closed - the gattlib_adapter_close() is called only when the adapter is provided by the caller.
"{&sv}" format string in loop, no need free the key. see "https://developer.gnome.org/glib/stable/gvariant-format-strings.html" section "Characters: &".