This patch frees memory allocated to duid by g_dhcpv6_create_duid() when
convert_to_hex() returns NULL. g_dhcpv6_create_duid() allocates memory to duid
variable when it returns 0 and duid_type is G_DHCPV6_DUID_LLT.
---
 src/dhcpv6.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/dhcpv6.c b/src/dhcpv6.c
index db9feb6..97ddc26 100644
--- a/src/dhcpv6.c
+++ b/src/dhcpv6.c
@@ -240,6 +240,7 @@ static int set_duid(struct connman_service *service,
 
                hex_duid = convert_to_hex(duid, duid_len);
                if (!hex_duid) {
+                       g_free(duid);
                        g_key_file_free(keyfile);
                        return -ENOMEM;
                }
-- 
1.9.1

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

Reply via email to