Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH] shared/gap: Fix memory leak in gap
@ 2014-12-19 12:13 Andrei Emeltchenko
  2014-12-19 12:29 ` Szymon Janc
  0 siblings, 1 reply; 3+ messages in thread
From: Andrei Emeltchenko @ 2014-12-19 12:13 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

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

diff --git a/src/shared/gap.c b/src/shared/gap.c
index 19059e8..3536c1c 100644
--- a/src/shared/gap.c
+++ b/src/shared/gap.c
@@ -276,5 +276,5 @@ bool bt_gap_add_peer_irk(struct bt_gap *gap, uint8_t addr_type,
 	memcpy(irk->addr, addr, 6);
 	memcpy(irk->key, key, 16);
 
-	return true;
+	return queue_push_tail(gap->irk_list, irk);
 }
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] shared/gap: Fix memory leak in gap
  2014-12-19 12:13 [PATCH] shared/gap: Fix memory leak in gap Andrei Emeltchenko
@ 2014-12-19 12:29 ` Szymon Janc
  2014-12-19 12:43   ` Andrei Emeltchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Szymon Janc @ 2014-12-19 12:29 UTC (permalink / raw)
  To: Andrei Emeltchenko; +Cc: linux-bluetooth

Hi Andrei,

On Friday 19 of December 2014 14:13:01 Andrei Emeltchenko wrote:
> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> 
> Allocated irk memory was never assigned.
> ---
>  src/shared/gap.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/shared/gap.c b/src/shared/gap.c
> index 19059e8..3536c1c 100644
> --- a/src/shared/gap.c
> +++ b/src/shared/gap.c
> @@ -276,5 +276,5 @@ bool bt_gap_add_peer_irk(struct bt_gap *gap, uint8_t addr_type,
>  	memcpy(irk->addr, addr, 6);
>  	memcpy(irk->key, key, 16);
>  
> -	return true;
> +	return queue_push_tail(gap->irk_list, irk);
>  }

For sanity this should free irk if push failed.

-- 
Best regards, 
Szymon Janc

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] shared/gap: Fix memory leak in gap
  2014-12-19 12:29 ` Szymon Janc
@ 2014-12-19 12:43   ` Andrei Emeltchenko
  0 siblings, 0 replies; 3+ messages in thread
From: Andrei Emeltchenko @ 2014-12-19 12:43 UTC (permalink / raw)
  To: Szymon Janc; +Cc: linux-bluetooth

Hi Szymon,

On Fri, Dec 19, 2014 at 01:29:39PM +0100, Szymon Janc wrote:
> Hi Andrei,
> 
> On Friday 19 of December 2014 14:13:01 Andrei Emeltchenko wrote:
> > From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> > 
> > Allocated irk memory was never assigned.
> > ---
> >  src/shared/gap.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/src/shared/gap.c b/src/shared/gap.c
> > index 19059e8..3536c1c 100644
> > --- a/src/shared/gap.c
> > +++ b/src/shared/gap.c
> > @@ -276,5 +276,5 @@ bool bt_gap_add_peer_irk(struct bt_gap *gap, uint8_t addr_type,
> >  	memcpy(irk->addr, addr, 6);
> >  	memcpy(irk->key, key, 16);
> >  
> > -	return true;
> > +	return queue_push_tail(gap->irk_list, irk);
> >  }
> 
> For sanity this should free irk if push failed.

Yes, I have sent new version.

Best regards 
Andrei Emeltchenko 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-12-19 12:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-19 12:13 [PATCH] shared/gap: Fix memory leak in gap Andrei Emeltchenko
2014-12-19 12:29 ` Szymon Janc
2014-12-19 12:43   ` Andrei Emeltchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox