linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] audio: fix leak on gateway
@ 2010-06-08  7:14 Gustavo F. Padovan
  2010-06-08  8:07 ` Johan Hedberg
  0 siblings, 1 reply; 2+ messages in thread
From: Gustavo F. Padovan @ 2010-06-08  7:14 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: gustavo

---
 audio/gateway.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/audio/gateway.c b/audio/gateway.c
index 1dd3f5b..07ebdd4 100644
--- a/audio/gateway.c
+++ b/audio/gateway.c
@@ -561,6 +561,19 @@ static GDBusSignalTable gateway_signals[] = {
 	{ NULL, NULL }
 };
 
+static void path_unregister(void *data)
+{
+	struct audio_device *dev = data;
+
+	DBG("Unregistered interface %s on path %s",
+		AUDIO_GATEWAY_INTERFACE, dev->path);
+
+	gateway_close(dev);
+
+	g_free(dev->gateway);
+	dev->gateway = NULL;
+}
+
 void gateway_unregister(struct audio_device *dev)
 {
 	if (dev->gateway->agent)
@@ -578,7 +591,7 @@ struct gateway *gateway_init(struct audio_device *dev)
 	if (!g_dbus_register_interface(dev->conn, dev->path,
 					AUDIO_GATEWAY_INTERFACE,
 					gateway_methods, gateway_signals,
-					NULL, dev, NULL))
+					NULL, dev, path_unregister))
 		return NULL;
 
 	return g_new0(struct gateway, 1);
-- 
1.7.1


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

end of thread, other threads:[~2010-06-08  8:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-08  7:14 [PATCH] audio: fix leak on gateway Gustavo F. Padovan
2010-06-08  8:07 ` Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).