From c80c789d050d53bdb7561746c06bbe51dfe319a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20Michalak-Szmaci=C5=84ski?= Date: Fri, 7 Jul 2023 16:39:11 +0200 Subject: [PATCH] Fix some memory leak (#27800) --- src/platform/Linux/bluez/Helper.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/platform/Linux/bluez/Helper.cpp b/src/platform/Linux/bluez/Helper.cpp index 56513651cbe8c3..6a1966cd2f949c 100644 --- a/src/platform/Linux/bluez/Helper.cpp +++ b/src/platform/Linux/bluez/Helper.cpp @@ -124,7 +124,7 @@ static BluezLEAdvertisement1 * BluezAdvertisingCreate(BluezEndpoint * apEndpoint BluezObjectSkeleton * object; GVariant * serviceData; GVariant * serviceUUID; - gchar * localName; + gchar * localName = nullptr; GVariantBuilder serviceDataBuilder; GVariantBuilder serviceUUIDsBuilder; char * debugStr; @@ -192,6 +192,7 @@ static BluezLEAdvertisement1 * BluezAdvertisingCreate(BluezEndpoint * apEndpoint BLEManagerImpl::NotifyBLEPeripheralAdvConfiguredComplete(true, nullptr); exit: + g_free(localName); return adv; } @@ -814,6 +815,9 @@ static BluezGattCharacteristic1 * BluezCharacteristicCreate(BluezGattService1 * bluez_object_skeleton_set_gatt_characteristic1(object, characteristic); g_dbus_object_manager_server_export(aRoot, G_DBUS_OBJECT_SKELETON(object)); + + g_free(charPath); + g_free(servicePath); g_object_unref(object); return characteristic;