From 86f9a742f36ea441701b7c8ec78c3f2e670bf224 Mon Sep 17 00:00:00 2001 From: Olivier Martin Date: Fri, 29 Mar 2024 09:18:53 +0100 Subject: [PATCH] Ensure connection timeout is freed when the connection is free --- dbus/gattlib.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dbus/gattlib.c b/dbus/gattlib.c index 123e12b..7f43211 100644 --- a/dbus/gattlib.c +++ b/dbus/gattlib.c @@ -299,6 +299,12 @@ void gattlib_connection_free(gatt_connection_t* connection) { conn_context->on_handle_device_property_change_id = 0; } + // Stop the timeout for connection + if (conn_context->connection_timeout_id) { + g_source_remove(conn_context->connection_timeout_id); + conn_context->connection_timeout_id = 0; + } + free(conn_context->device_object_path); if (conn_context->device != NULL) { g_object_unref(conn_context->device);