2014-12-19 12:37:33

by Andrei Emeltchenko

[permalink] [raw]
Subject: [PATCHv2] shared/gap: Fix memory leak in gap

From: Andrei Emeltchenko <[email protected]>

Allocated irk memory was never assigned.
---
src/shared/gap.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/src/shared/gap.c b/src/shared/gap.c
index 19059e8..cc48a02 100644
--- a/src/shared/gap.c
+++ b/src/shared/gap.c
@@ -276,5 +276,10 @@ bool bt_gap_add_peer_irk(struct bt_gap *gap, uint8_t addr_type,
memcpy(irk->addr, addr, 6);
memcpy(irk->key, key, 16);

+ if (!queue_push_tail(gap->irk_list, irk)) {
+ free(irk);
+ return false;
+ }
+
return true;
}
--
2.1.0



2014-12-22 11:56:01

by Andrei Emeltchenko

[permalink] [raw]
Subject: Re: [PATCHv2] shared/gap: Fix memory leak in gap

ping

On Fri, Dec 19, 2014 at 02:37:33PM +0200, Andrei Emeltchenko wrote:
> From: Andrei Emeltchenko <[email protected]>
>
> Allocated irk memory was never assigned.
> ---
> src/shared/gap.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/src/shared/gap.c b/src/shared/gap.c
> index 19059e8..cc48a02 100644
> --- a/src/shared/gap.c
> +++ b/src/shared/gap.c
> @@ -276,5 +276,10 @@ bool bt_gap_add_peer_irk(struct bt_gap *gap, uint8_t addr_type,
> memcpy(irk->addr, addr, 6);
> memcpy(irk->key, key, 16);
>
> + if (!queue_push_tail(gap->irk_list, irk)) {
> + free(irk);
> + return false;
> + }
> +
> return true;
> }
> --
> 2.1.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

2015-01-09 09:47:42

by Johan Hedberg

[permalink] [raw]
Subject: Re: [PATCHv2] shared/gap: Fix memory leak in gap

Hi Andrei,


On Fri, Dec 19, 2014, Andrei Emeltchenko wrote:
> Allocated irk memory was never assigned.
> ---
> src/shared/gap.c | 5 +++++
> 1 file changed, 5 insertions(+)

Applied. Thanks.

Johan

2015-01-08 14:20:53

by Andrei Emeltchenko

[permalink] [raw]
Subject: Re: [PATCHv2] shared/gap: Fix memory leak in gap

ping

On Mon, Dec 22, 2014 at 01:56:01PM +0200, Andrei Emeltchenko wrote:
> ping
>
> On Fri, Dec 19, 2014 at 02:37:33PM +0200, Andrei Emeltchenko wrote:
> > From: Andrei Emeltchenko <[email protected]>
> >
> > Allocated irk memory was never assigned.
> > ---
> > src/shared/gap.c | 5 +++++
> > 1 file changed, 5 insertions(+)
> >
> > diff --git a/src/shared/gap.c b/src/shared/gap.c
> > index 19059e8..cc48a02 100644
> > --- a/src/shared/gap.c
> > +++ b/src/shared/gap.c
> > @@ -276,5 +276,10 @@ bool bt_gap_add_peer_irk(struct bt_gap *gap, uint8_t addr_type,
> > memcpy(irk->addr, addr, 6);
> > memcpy(irk->key, key, 16);
> >
> > + if (!queue_push_tail(gap->irk_list, irk)) {
> > + free(irk);
> > + return false;
> > + }
> > +
> > return true;
> > }
> > --
> > 2.1.0
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> > the body of a message to [email protected]
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html