linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anderson Lizardo <anderson.lizardo@openbossa.org>
To: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH BlueZ] Fix memory leak when loading keys
Date: Tue, 24 Jan 2012 06:40:03 -0400	[thread overview]
Message-ID: <CAJdJm_N+FXcJfXm_1eEmjJUp0c4Ek2OL3gJrSnRyfjmoCPNG5A@mail.gmail.com> (raw)
In-Reply-To: <1327364511-6348-1-git-send-email-vinicius.gomes@openbossa.org>

Hi Vinicius,

On Mon, Jan 23, 2012 at 8:21 PM, Vinicius Costa Gomes
<vinicius.gomes@openbossa.org> wrote:
> @@ -3570,7 +3571,16 @@ static int hciops_load_keys(int index, GSList *keys, gboolean debug_keys)
>        if (dev->keys != NULL)
>                return -EEXIST;
>
> -       dev->keys = keys;
> +       for (l = keys; l; l = l->next) {
> +               struct link_key_info *orig, *dup;
> +
> +               orig = l->data;
> +
> +               dup = g_memdup(orig, sizeof(*orig));
> +
> +               dev->keys = g_slist_prepend(dev->keys, dup);
> +       }
> +

No need to cleanup dev->keys first?

Regards,
-- 
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil

  reply	other threads:[~2012-01-24 10:40 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-18 23:13 [PATCH BlueZ v2 1/4] Add support for creating devices from the stored LTK's Vinicius Costa Gomes
2012-01-18 23:13 ` [PATCH BlueZ v2 2/4] Use the helper function to convert a string to a binary buffer Vinicius Costa Gomes
2012-01-18 23:13 ` [PATCH BlueZ v2 3/4] Fix memory leak when loading keys Vinicius Costa Gomes
2012-01-23 11:12   ` Johan Hedberg
2012-01-23 13:29     ` Vinicius Costa Gomes
2012-01-24  0:21       ` [PATCH BlueZ] " Vinicius Costa Gomes
2012-01-24 10:40         ` Anderson Lizardo [this message]
2012-01-24 10:46           ` Johan Hedberg
2012-01-24 11:46             ` Anderson Lizardo
2012-01-24 13:02         ` Johan Hedberg
2012-01-24 13:34           ` Vinicius Costa Gomes
2012-01-24 13:39             ` Johan Hedberg
2012-01-24 13:48               ` Vinicius Costa Gomes
2012-01-18 23:13 ` [PATCH BlueZ v2 4/4] Remove the SMP Long Term Key when the device is removed Vinicius Costa Gomes
2012-01-23 11:13   ` Johan Hedberg

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=CAJdJm_N+FXcJfXm_1eEmjJUp0c4Ek2OL3gJrSnRyfjmoCPNG5A@mail.gmail.com \
    --to=anderson.lizardo@openbossa.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=vinicius.gomes@openbossa.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).