[PATCH BlueZ] adapt:Set property mode failed,memory leak

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch will fix a memory leak,when set property mode,it will send a msg,
but if failed,the data'memory do not free
---
 ...Set-property-mode-failed-memory-leak.patch | 26 +++++++++++++++++++
 src/adapter.c                                 |  1 +
 2 files changed, 27 insertions(+)
 create mode 100644 0001-adapt-Set-property-mode-failed-memory-leak.patch

diff --git a/0001-adapt-Set-property-mode-failed-memory-leak.patch b/0001-adapt-Set-property-mode-failed-memory-leak.patch
new file mode 100644
index 000000000..4994e03a6
--- /dev/null
+++ b/0001-adapt-Set-property-mode-failed-memory-leak.patch
@@ -0,0 +1,26 @@
+From 62d56bedbd32662b3f33af99dd464d67958e76d6 Mon Sep 17 00:00:00 2001
+From: chengbo <515672508@xxxxxx>
+Date: Fri, 14 Aug 2020 17:09:51 +0800
+Subject: [PATCH BlueZ] adapt:Set property mode failed,memory leak This patch
+ will fix a memory leak,when set property mode,it will send a msg, but if
+ failed,the data'memory do not free
+
+---
+ src/adapter.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/adapter.c b/src/adapter.c
+index 5e896a9f0..cb4cd8b75 100644
+--- a/src/adapter.c
++++ b/src/adapter.c
+@@ -2918,6 +2918,7 @@ static void property_set_mode(struct btd_adapter *adapter, uint32_t setting,
+ 
+ 	if (mgmt_send(adapter->mgmt, opcode, adapter->dev_id, len, param,
+ 			property_set_mode_complete, data, g_free) > 0)
++		g_free(data);
+ 		return;
+ 
+ 	g_free(data);
+-- 
+2.20.1
+
diff --git a/src/adapter.c b/src/adapter.c
index 5e896a9f0..cb4cd8b75 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -2918,6 +2918,7 @@ static void property_set_mode(struct btd_adapter *adapter, uint32_t setting,
 
 	if (mgmt_send(adapter->mgmt, opcode, adapter->dev_id, len, param,
 			property_set_mode_complete, data, g_free) > 0)
+		g_free(data);
 		return;
 
 	g_free(data);
-- 
2.20.1






[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux