Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH] Fix refcount in btd_adapter_any_request_path()
@ 2011-02-04  4:05 Anderson Lizardo
  2011-02-04  4:58 ` Johan Hedberg
  0 siblings, 1 reply; 2+ messages in thread
From: Anderson Lizardo @ 2011-02-04  4:05 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anderson Lizardo

adapter_any_refcount was not being incremented when a pointer to
allocated buffer was returned.
---
 src/adapter.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index 08098a5..3e609c1 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -3428,11 +3428,10 @@ const char *adapter_any_get_path(void)
 
 const char *btd_adapter_any_request_path(void)
 {
-	if (adapter_any_refcount > 0)
+	if (adapter_any_refcount++ > 0)
 		return adapter_any_path;
 
 	adapter_any_path = g_strdup_printf("%s/any", manager_get_base_path());
-	adapter_any_refcount++;
 
 	return adapter_any_path;
 }
-- 
1.7.0.4


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

* Re: [PATCH] Fix refcount in btd_adapter_any_request_path()
  2011-02-04  4:05 [PATCH] Fix refcount in btd_adapter_any_request_path() Anderson Lizardo
@ 2011-02-04  4:58 ` Johan Hedberg
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2011-02-04  4:58 UTC (permalink / raw)
  To: Anderson Lizardo; +Cc: linux-bluetooth

Hi Lizardo,

On Fri, Feb 04, 2011, Anderson Lizardo wrote:
> adapter_any_refcount was not being incremented when a pointer to
> allocated buffer was returned.
> ---
>  src/adapter.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
> 
> diff --git a/src/adapter.c b/src/adapter.c
> index 08098a5..3e609c1 100644
> --- a/src/adapter.c
> +++ b/src/adapter.c
> @@ -3428,11 +3428,10 @@ const char *adapter_any_get_path(void)
>  
>  const char *btd_adapter_any_request_path(void)
>  {
> -	if (adapter_any_refcount > 0)
> +	if (adapter_any_refcount++ > 0)
>  		return adapter_any_path;
>  
>  	adapter_any_path = g_strdup_printf("%s/any", manager_get_base_path());
> -	adapter_any_refcount++;
>  
>  	return adapter_any_path;
>  }

Nice catch. The patch has been pushed upstream. Thanks.

Johan

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

end of thread, other threads:[~2011-02-04  4:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-04  4:05 [PATCH] Fix refcount in btd_adapter_any_request_path() Anderson Lizardo
2011-02-04  4:58 ` Johan Hedberg

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