summaryrefslogtreecommitdiffstats
path: root/src/BluetoothManager.cpp
diff options
context:
space:
mode:
authorTzafrir Poupko <[email protected]>2017-08-06 11:50:15 +0300
committerpetreeftime <[email protected]>2017-08-06 15:19:46 +0300
commitb3c053cd2707ae12de7d85fd994cdbda604503a6 (patch)
tree1f65a9b40c9c224abfe10eda72d135f8a263f0f5 /src/BluetoothManager.cpp
parent6a643b32c0b6ed538b557bf86ad4ba151dd966ff (diff)
Fix memory leak with g_objects
BluetoothObject constructor maintains internally a g_object reference to the underlying object. This means that any g_object obtained externally should be unreferenced after the BluetoothObject is constructed. Signed-off-by: Tzafrir Poupko <[email protected]>
Diffstat (limited to 'src/BluetoothManager.cpp')
-rw-r--r--src/BluetoothManager.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/BluetoothManager.cpp b/src/BluetoothManager.cpp
index f83fb2e2..b4cdbd08 100644
--- a/src/BluetoothManager.cpp
+++ b/src/BluetoothManager.cpp
@@ -287,6 +287,7 @@ BluetoothManager::BluetoothManager() : event_list()
Adapter1 *adapter = object_get_adapter1(object);
if (adapter != NULL) {
default_adapter = std::unique_ptr<BluetoothAdapter>(new BluetoothAdapter(adapter));
+ g_object_unref(adapter);
break;
}
}