From 18b9c5d78b12cfd76078c8fc6aea5e60da47d20d Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Wed, 10 Aug 2011 11:17:50 +0300 Subject: [PATCH] obexd: Fix memory leak in opp plugin Folder and name can point to allocated memory so they need to be freed before returning. Thanks for Daniele Forsi for reporting it. --- obexd/plugins/opp.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/obexd/plugins/opp.c b/obexd/plugins/opp.c index 644a2c675..fd78af45d 100644 --- a/obexd/plugins/opp.c +++ b/obexd/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); -- 2.47.3