gattlib icon indicating copy to clipboard operation
gattlib copied to clipboard

fix memory leak errors

Open chenbinn opened this issue 4 years ago • 3 comments

"{&sv}" format string in loop, no need free the key. see "https://developer.gnome.org/glib/stable/gvariant-format-strings.html" section "Characters: &".

chenbinn avatar Apr 19 '21 16:04 chenbinn

I would strongly recommend merging this commit. It fixes a really annoying 'memory freeing' bug.

kaifastromai avatar Apr 21 '21 17:04 kaifastromai

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.

luknowak avatar Aug 24 '22 20:08 luknowak

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.

luknowak avatar Aug 24 '22 21:08 luknowak