linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH obexd] Fix memory leak on opp plugin
@ 2011-08-10  8:17 Luiz Augusto von Dentz
  2011-08-10  9:34 ` Johan Hedberg
  0 siblings, 1 reply; 2+ messages in thread
From: Luiz Augusto von Dentz @ 2011-08-10  8:17 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

Folder and name can point to allocated memory so they need to be freed
before returning.

Thanks for Daniele Forsi <dforsi@gmail.com> for reporting it.
---
 plugins/opp.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/plugins/opp.c b/plugins/opp.c
index 644a2c6..fd78af4 100644
--- a/plugins/opp.c
+++ b/plugins/opp.c
@@ -142,8 +142,10 @@ static int opp_chkput(struct obex_session *os, void *user_data)
 		name = g_strdup(obex_get_name(os));
 
 skip_auth:
-	if (name == NULL || strlen(name) == 0)
-		return -EBADR;
+	if (name == NULL || strlen(name) == 0) {
+		ret = -EBADR;
+		goto failed;
+	}
 
 	if (g_strcmp0(name, obex_get_name(os)) != 0)
 		obex_set_name(os, name);
@@ -155,6 +157,8 @@ skip_auth:
 	ret = obex_put_stream_start(os, path);
 
 	g_free(path);
+
+failed:
 	g_free(folder);
 	g_free(name);
 
-- 
1.7.6


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

* Re: [PATCH obexd] Fix memory leak on opp plugin
  2011-08-10  8:17 [PATCH obexd] Fix memory leak on opp plugin Luiz Augusto von Dentz
@ 2011-08-10  9:34 ` Johan Hedberg
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2011-08-10  9:34 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

Hi Luiz,

On Wed, Aug 10, 2011, Luiz Augusto von Dentz wrote:
> Folder and name can point to allocated memory so they need to be freed
> before returning.
> 
> Thanks for Daniele Forsi <dforsi@gmail.com> for reporting it.
> ---
>  plugins/opp.c |    8 ++++++--
>  1 files changed, 6 insertions(+), 2 deletions(-)

Applied. Thanks.

Johan

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

end of thread, other threads:[~2011-08-10  9:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-10  8:17 [PATCH obexd] Fix memory leak on opp plugin Luiz Augusto von Dentz
2011-08-10  9:34 ` 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).