Send connman mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.01.org/mailman/listinfo/connman
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of connman digest..."


Today's Topics:

   1. [PATCH] bluetooth: Fix Memory Leak (Niraj Kumar Goit)
   2. [PATCH] commands: Fix memory leak (Niraj Kumar Goit)
   3. [PATCH] commands: Fix memory leak (Niraj Kumar Goit)


----------------------------------------------------------------------

Message: 1
Date: Sun, 24 Jan 2016 16:03:31 +0530
From: Niraj Kumar Goit <[email protected]>
To: [email protected]
Cc: [email protected]
Subject: [PATCH] bluetooth: Fix Memory Leak
Message-ID: <[email protected]>

tethering struct is allocated memory but not freed in case of error.
---
 plugins/bluetooth.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/plugins/bluetooth.c b/plugins/bluetooth.c
index 6e4feba..3bf8f0f 100644
--- a/plugins/bluetooth.c
+++ b/plugins/bluetooth.c
@@ -718,12 +718,16 @@ static bool tethering_create(const char *path,
 
        DBG("path %s bridge %s", path, bridge);
 
-       if (!bridge)
+       if (!bridge) {
+               g_free(tethering);
                return -EINVAL;
+       }
 
        proxy = g_dbus_proxy_new(client, path, "org.bluez.NetworkServer1");
-       if (!proxy)
+       if (!proxy) {
+               g_free(tethering);
                return false;
+       }
 
        tethering->technology = technology;
        tethering->bridge = g_strdup(bridge);
-- 
1.7.9.5




------------------------------

Message: 2
Date: Sun, 24 Jan 2016 16:24:36 +0530
From: Niraj Kumar Goit <[email protected]>
To: [email protected]
Cc: [email protected]
Subject: [PATCH] commands: Fix memory leak
Message-ID: <[email protected]>

In cmd_service_move_before() function, memory is allocated to services
struct but not freed in case of error.
---
 client/commands.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/client/commands.c b/client/commands.c
index db24d16..cf47d4e 100644
--- a/client/commands.c
+++ b/client/commands.c
@@ -797,14 +797,20 @@ static int cmd_service_move_before(char *args[], int num,
        const char *iface = "net.connman.Service";
        struct move_service *services = g_new(struct move_service, 1);
 
-       if (num > 3)
+       if (num > 3) {
+               g_free(services);
                return -E2BIG;
+       }
 
-       if (num < 3)
+       if (num < 3) {
+               g_free(services);
                return -EINVAL;
+       }
 
-       if (check_dbus_name(args[1]) == false)
+       if (check_dbus_name(args[1]) == false) {
+               g_free(services);
                return -EINVAL;
+       }
 
        services->service = g_strdup_printf("/net/connman/service/%s", args[1]);
        services->target = g_strdup_printf("/net/connman/service/%s", args[2]);
-- 
1.7.9.5




------------------------------

Message: 3
Date: Sun, 24 Jan 2016 16:37:10 +0530
From: Niraj Kumar Goit <[email protected]>
To: [email protected]
Cc: [email protected]
Subject: [PATCH] commands: Fix memory leak
Message-ID: <[email protected]>

In cmd_service_move_after() function, memory is allocated to
services struct but not freed in case of error.
---
 client/commands.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/client/commands.c b/client/commands.c
index cf47d4e..b0a91eb 100644
--- a/client/commands.c
+++ b/client/commands.c
@@ -861,14 +861,20 @@ static int cmd_service_move_after(char *args[], int num,
        const char *iface = "net.connman.Service";
        struct move_service *services = g_new(struct move_service, 1);
 
-       if (num > 3)
+       if (num > 3) {
+               g_free(services);
                return -E2BIG;
+       }
 
-       if (num < 3)
+       if (num < 3) {
+               g_free(services);
                return -EINVAL;
+       }
 
-       if (check_dbus_name(args[1]) == false)
+       if (check_dbus_name(args[1]) == false) {
+               g_free(services);
                return -EINVAL;
+       }
 
        services->service = g_strdup_printf("/net/connman/service/%s", args[1]);
        services->target = g_strdup_printf("/net/connman/service/%s", args[2]);
-- 
1.7.9.5




------------------------------

Subject: Digest Footer

_______________________________________________
connman mailing list
[email protected]
https://lists.01.org/mailman/listinfo/connman


------------------------------

End of connman Digest, Vol 3, Issue 17
**************************************

Reply via email to