All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: Syam Sidhardhan <s.syam@samsung.com>
Cc: "linux-bluetooth@vger.kernel.org"
	<linux-bluetooth@vger.kernel.org>,
	"syamsidhardh@gmail.com" <syamsidhardh@gmail.com>
Subject: Re: [PATCH 1/1] adapter: Fix memory leak
Date: Thu, 11 Feb 2016 16:14:06 +0200	[thread overview]
Message-ID: <CABBYNZ+10QhEwqerBjre9Q6-35Vgd7tgPbV+GD4-Mus6SB5Kww@mail.gmail.com> (raw)
In-Reply-To: <523397950.738031454943754387.JavaMail.weblogic@epmlwas06a>

Hi Syam,

On Mon, Feb 8, 2016 at 5:02 PM, SYAM SIDHARDHAN <s.syam@samsung.com> wrote:
>
> Hi,
> ------- Original Message -------
> Sender : SYAM SIDHARDHAN<s.syam@samsung.com> ./Senior Chief Engineer/SRI-Bangalore-System & Connectivity/Samsung Electronics
> Date : Feb 03, 2016 20:28 (GMT+05:30)
> Title : [PATCH 1/1] adapter: Fix memory leak
>
> if strlen(str) < 32 then there is a memory leak.
> ---
> src/adapter.c |    5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/src/adapter.c b/src/adapter.c
> index b184eed..f4fbf82 100644
> --- a/src/adapter.c
> +++ b/src/adapter.c
> @@ -3091,12 +3091,12 @@ static GSList *get_ltk_info(GKeyFile *key_file, const char *peer,
> static struct irk_info *get_irk_info(GKeyFile *key_file, const char *peer,
> uint8_t bdaddr_type)
> {
> - struct irk_info *irk;
> + struct irk_info *irk = NULL;
> char *str;
>
> str = g_key_file_get_string(key_file, "IdentityResolvingKey", "Key", NULL);
> if (!str || strlen(str) < 32)
> - return NULL;
> + goto failed;
>
> irk = g_new0(struct irk_info, 1);
>
> @@ -3108,6 +3108,7 @@ static struct irk_info *get_irk_info(GKeyFile *key_file, const char *peer,
> else
> str2buf(&str[0], irk->val, sizeof(irk->val));
>
> +failed:
> g_free(str);
>
> return irk;
> --
> 1.7.9.5
>

Applied, thanks.


-- 
Luiz Augusto von Dentz

  reply	other threads:[~2016-02-11 14:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-08 15:02 [PATCH 1/1] adapter: Fix memory leak SYAM SIDHARDHAN
2016-02-11 14:14 ` Luiz Augusto von Dentz [this message]
  -- strict thread matches above, loose matches on Subject: below --
2016-02-03 14:58 Syam Sidhardhan

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=CABBYNZ+10QhEwqerBjre9Q6-35Vgd7tgPbV+GD4-Mus6SB5Kww@mail.gmail.com \
    --to=luiz.dentz@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=s.syam@samsung.com \
    --cc=syamsidhardh@gmail.com \
    /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.