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] dhcpv6: Fix memory leak if for loop breaks (Saurav Babu)


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

Message: 1
Date: Thu, 11 Feb 2016 22:12:04 +0530
From: Saurav Babu <[email protected]>
To: [email protected]
Cc: [email protected]
Subject: [PATCH] dhcpv6: Fix memory leak if for loop breaks
Message-ID:
        <[email protected]>

This patch duplicates string only when it is required so that there is
no memory leak when for loop breaks.
---
 src/dhcpv6.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/dhcpv6.c b/src/dhcpv6.c
index 97ddc26..9e21040 100644
--- a/src/dhcpv6.c
+++ b/src/dhcpv6.c
@@ -447,7 +447,6 @@ static int check_ipv6_addr_prefix(GSList *prefixes, char 
*address)
                if (!slash)
                        continue;
 
-               prefix = g_strndup(prefix, slash - prefix);
                len = strtol(slash + 1, NULL, 10);
                if (len < 3 || len > 128)
                        break;
@@ -458,6 +457,7 @@ static int check_ipv6_addr_prefix(GSList *prefixes, char 
*address)
                left = plen % 8;
                i = 16 - count;
 
+               prefix = g_strndup(prefix, slash - prefix);
                inet_pton(AF_INET6, prefix, &addr_prefix);
                inet_pton(AF_INET6, address, &addr);
 
-- 
1.9.1



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

Subject: Digest Footer

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


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

End of connman Digest, Vol 4, Issue 14
**************************************

Reply via email to