Commit 28027320 by Serge Hallyn

fix coverity-found resource leaks in config_network_ipv6

parent bb1d2274
...@@ -726,6 +726,7 @@ static int config_network_ipv6(const char *key, const char *value, ...@@ -726,6 +726,7 @@ static int config_network_ipv6(const char *key, const char *value,
list = malloc(sizeof(*list)); list = malloc(sizeof(*list));
if (!list) { if (!list) {
SYSERROR("failed to allocate memory"); SYSERROR("failed to allocate memory");
free(inet6dev);
return -1; return -1;
} }
...@@ -735,6 +736,8 @@ static int config_network_ipv6(const char *key, const char *value, ...@@ -735,6 +736,8 @@ static int config_network_ipv6(const char *key, const char *value,
valdup = strdup(value); valdup = strdup(value);
if (!valdup) { if (!valdup) {
ERROR("no address specified"); ERROR("no address specified");
free(list);
free(inet6dev);
return -1; return -1;
} }
...@@ -748,6 +751,8 @@ static int config_network_ipv6(const char *key, const char *value, ...@@ -748,6 +751,8 @@ static int config_network_ipv6(const char *key, const char *value,
if (!inet_pton(AF_INET6, value, &inet6dev->addr)) { if (!inet_pton(AF_INET6, value, &inet6dev->addr)) {
SYSERROR("invalid ipv6 address: %s", value); SYSERROR("invalid ipv6 address: %s", value);
free(list);
free(inet6dev);
free(valdup); free(valdup);
return -1; return -1;
} }
...@@ -785,6 +790,7 @@ static int config_network_ipv6_gateway(const char *key, const char *value, ...@@ -785,6 +790,7 @@ static int config_network_ipv6_gateway(const char *key, const char *value,
} else { } else {
if (!inet_pton(AF_INET6, value, gw)) { if (!inet_pton(AF_INET6, value, gw)) {
SYSERROR("invalid ipv6 gateway address: %s", value); SYSERROR("invalid ipv6 gateway address: %s", value);
free(gw);
return -1; return -1;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment