All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: chengbo <515672508@qq.com>
Cc: "linux-bluetooth@vger.kernel.org" <linux-bluetooth@vger.kernel.org>
Subject: Re: [PATCH BlueZ] adapt:Set property mode failed,memory leak
Date: Fri, 14 Aug 2020 12:48:27 -0700	[thread overview]
Message-ID: <CABBYNZKeMkbqnn1qswaLVcLxuAmc6OFPjVUidTiYSpAGvna=Rw@mail.gmail.com> (raw)
In-Reply-To: <20200814100047.11008-1-515672508@qq.com>

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
>
>
>


-- 
Luiz Augusto von Dentz

      reply	other threads:[~2020-08-14 19:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-14 10:00 [PATCH BlueZ] adapt:Set property mode failed,memory leak chengbo
2020-08-14 19:48 ` Luiz Augusto von Dentz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CABBYNZKeMkbqnn1qswaLVcLxuAmc6OFPjVUidTiYSpAGvna=Rw@mail.gmail.com' \
    --to=luiz.dentz@gmail.com \
    --cc=515672508@qq.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.