diff mbox series

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

Message ID 20200814100047.11008-1-515672508@qq.com (mailing list archive)
State Accepted
Delegated to: Luiz Von Dentz
Headers show
Series [BlueZ] adapt:Set property mode failed,memory leak | expand

Commit Message

chengbo Aug. 14, 2020, 10 a.m. UTC
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

Comments

Luiz Augusto von Dentz Aug. 14, 2020, 7:48 p.m. UTC | #1
Hi,

On Fri, Aug 14, 2020 at 4:40 AM chengbo <515672508@qq.com> wrote:
>
> 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

Give a look to HACKING documentation on how to properly format patches
as it looks like you are appending the first version on this one as
well.

> ---
>  ...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@qq.com>
> +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
>
>
>
diff mbox series

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@qq.com>
+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);