Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH] gateway: Fix crash if SCO connection fails
@ 2012-02-07 17:04 Frédéric Dalleau
  2012-02-07 18:07 ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 3+ messages in thread
From: Frédéric Dalleau @ 2012-02-07 17:04 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Frédéric Dalleau

In some situations, a connect callback is created, but
this callback is not added to media_owner. Thus when the owner
is destroyed and at rfcomm disconnect, the callback is executed
with an invalid pointer.
---
 audio/gateway.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/audio/gateway.c b/audio/gateway.c
index bde3e02..fc453dd 100644
--- a/audio/gateway.c
+++ b/audio/gateway.c
@@ -836,12 +836,9 @@ unsigned int gateway_request_stream(struct audio_device *dev,
 				gateway_stream_cb_t cb, void *user_data)
 {
 	struct gateway *gw = dev->gateway;
-	unsigned int id;
 	GError *err = NULL;
 	GIOChannel *io;
 
-	id = connect_cb_new(gw, cb, user_data);
-
 	if (!gw->rfcomm)
 		get_records(dev);
 	else if (!gw->sco) {
@@ -858,7 +855,7 @@ unsigned int gateway_request_stream(struct audio_device *dev,
 	} else
 		g_idle_add(request_stream_cb, dev);
 
-	return id;
+	return connect_cb_new(gw, cb, user_data);
 }
 
 int gateway_config_stream(struct audio_device *dev, gateway_stream_cb_t cb,
-- 
1.7.5.4


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

end of thread, other threads:[~2012-02-07 19:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-07 17:04 [PATCH] gateway: Fix crash if SCO connection fails Frédéric Dalleau
2012-02-07 18:07 ` Luiz Augusto von Dentz
2012-02-07 19:30   ` Dalleau, Frederic

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