summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiraj Kumar Goit <niraj.g@samsung.com>2016-02-22 19:50:53 +0530
committerNiraj Kumar Goit <niraj.g@samsung.com>2016-02-23 12:55:51 +0530
commitcf570f852323cbb268e7c035aa520015c398622a (patch)
tree2979bd570c258bb376b231c99df83cb372198b9a
parentcdd2029ca7173fb2231f7cd0b8be8ef7503f4034 (diff)
downloadconnman-cf570f852323cbb268e7c035aa520015c398622a.tar.gz
connman-cf570f852323cbb268e7c035aa520015c398622a.tar.bz2
connman-cf570f852323cbb268e7c035aa520015c398622a.zip
bluetooth: Fix Memory Leak
To avoid memory leak issue allocate memory to tethering structure after all error checks. Change-Id: If10578acce2eb8eedbdbc96f73a30c79c1a7a125 Signed-off-by: Niraj Kumar Goit <niraj.g@samsung.com>
-rwxr-xr-xplugins/bluetooth.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/plugins/bluetooth.c b/plugins/bluetooth.c
index e1d4b599..24f3aa52 100755
--- a/plugins/bluetooth.c
+++ b/plugins/bluetooth.c
@@ -723,7 +723,7 @@ static bool tethering_create(const char *path,
struct connman_technology *technology, const char *bridge,
bool enabled)
{
- struct tethering_info *tethering = g_new0(struct tethering_info, 1);
+ struct tethering_info *tethering;
GDBusProxy *proxy;
const char *method;
bool result;
@@ -737,6 +737,8 @@ static bool tethering_create(const char *path,
if (!proxy)
return false;
+ tethering = g_new0(struct tethering_info, 1);
+
tethering->technology = technology;
tethering->bridge = g_strdup(bridge);
tethering->enable = enabled;