linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH obexd 1/6] client: fix memory leak in obc_session_put
@ 2012-02-13 14:39 Mikel Astiz
  2012-02-13 14:39 ` [PATCH obexd 2/6] client: fix unreported error case Mikel Astiz
                   ` (5 more replies)
  0 siblings, 6 replies; 15+ messages in thread
From: Mikel Astiz @ 2012-02-13 14:39 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Mikel Astiz

From: Mikel Astiz <mikel.astiz@bmw-carit.de>

obc_session_put takes ownership of the given buffer, but did not free
the memory in case of error.
---
 client/session.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/client/session.c b/client/session.c
index 585e402..cb46510 100644
--- a/client/session.c
+++ b/client/session.c
@@ -1007,8 +1007,10 @@ int obc_session_put(struct obc_session *session, char *buf, const char *targetna
 	struct obc_transfer *transfer;
 	const char *agent;
 
-	if (session->obex == NULL)
+	if (session->obex == NULL) {
+		g_free(buf);
 		return -ENOTCONN;
+	}
 
 	agent = obc_agent_get_name(session->agent);
 
@@ -1016,8 +1018,10 @@ int obc_session_put(struct obc_session *session, char *buf, const char *targetna
 							agent, NULL,
 							targetname, NULL,
 							NULL);
-	if (transfer == NULL)
+	if (transfer == NULL) {
+		g_free(buf);
 		return -EIO;
+	}
 
 	obc_transfer_set_buffer(transfer, buf);
 
-- 
1.7.6.5


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

end of thread, other threads:[~2012-02-14 13:03 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-13 14:39 [PATCH obexd 1/6] client: fix memory leak in obc_session_put Mikel Astiz
2012-02-13 14:39 ` [PATCH obexd 2/6] client: fix unreported error case Mikel Astiz
2012-02-14  9:11   ` Luiz Augusto von Dentz
2012-02-13 14:39 ` [PATCH obexd 3/6] client: fix incorrect error check Mikel Astiz
2012-02-14  9:16   ` Luiz Augusto von Dentz
2012-02-14 12:59     ` Johan Hedberg
2012-02-13 14:39 ` [PATCH obexd 4/6] client: fix pbap select when same path given twice Mikel Astiz
2012-02-14  9:17   ` Luiz Augusto von Dentz
2012-02-14 13:01   ` Johan Hedberg
2012-02-13 14:39 ` [PATCH obexd 5/6] client: queue transfers in ftp sessions Mikel Astiz
2012-02-14  9:23   ` Luiz Augusto von Dentz
2012-02-13 14:39 ` [PATCH obexd 6/6] client: queue transfers in pbap sessions Mikel Astiz
2012-02-14  9:24   ` Luiz Augusto von Dentz
2012-02-14 13:03   ` Johan Hedberg
2012-02-14  8:54 ` [PATCH obexd 1/6] client: fix memory leak in obc_session_put Luiz Augusto von Dentz

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).