Re: [PATCH BlueZ] Fix memory leak when loading keys

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

 



Hi Vinicius,

On Mon, Jan 23, 2012 at 8:21 PM, Vinicius Costa Gomes
<vinicius.gomes@xxxxxxxxxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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