Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH] android/avdtp: Fix crash when DISCOVER failed
@ 2014-03-05 14:02 Andrzej Kaczmarek
  2014-03-05 15:46 ` Szymon Janc
  0 siblings, 1 reply; 2+ messages in thread
From: Andrzej Kaczmarek @ 2014-03-05 14:02 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Andrzej Kaczmarek

Discover callback is only set when avdtp_discover was successful so we
need to check if it's set before calling.
---
 android/avdtp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/android/avdtp.c b/android/avdtp.c
index f104e3e..96c7d0d 100644
--- a/android/avdtp.c
+++ b/android/avdtp.c
@@ -937,7 +937,8 @@ static void finalize_discovery(struct avdtp *session, int err)
 	if (discover->id > 0)
 		g_source_remove(discover->id);
 
-	discover->cb(session, session->seps, err ? &avdtp_err : NULL,
+	if (discover->cb)
+		discover->cb(session, session->seps, err ? &avdtp_err : NULL,
 							discover->user_data);
 	g_free(discover);
 }
-- 
1.8.5.4


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

* Re: [PATCH] android/avdtp: Fix crash when DISCOVER failed
  2014-03-05 14:02 [PATCH] android/avdtp: Fix crash when DISCOVER failed Andrzej Kaczmarek
@ 2014-03-05 15:46 ` Szymon Janc
  0 siblings, 0 replies; 2+ messages in thread
From: Szymon Janc @ 2014-03-05 15:46 UTC (permalink / raw)
  To: Andrzej Kaczmarek; +Cc: linux-bluetooth

Hi Andrzej,

On Wednesday 05 of March 2014 15:02:30 Andrzej Kaczmarek wrote:
> Discover callback is only set when avdtp_discover was successful so we
> need to check if it's set before calling.
> ---
>  android/avdtp.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/android/avdtp.c b/android/avdtp.c
> index f104e3e..96c7d0d 100644
> --- a/android/avdtp.c
> +++ b/android/avdtp.c
> @@ -937,7 +937,8 @@ static void finalize_discovery(struct avdtp *session, int err)
>  	if (discover->id > 0)
>  		g_source_remove(discover->id);
>  
> -	discover->cb(session, session->seps, err ? &avdtp_err : NULL,
> +	if (discover->cb)
> +		discover->cb(session, session->seps, err ? &avdtp_err : NULL,
>  							discover->user_data);
>  	g_free(discover);
>  }
> 

Applied.

-- 
Best regards, 
Szymon Janc

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

end of thread, other threads:[~2014-03-05 15:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-05 14:02 [PATCH] android/avdtp: Fix crash when DISCOVER failed Andrzej Kaczmarek
2014-03-05 15:46 ` Szymon Janc

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