From: Daniel Wagner <[email protected]>

ipv4_addr and ipv6_addr are assigned to src which is then access
outside of the scope. Let's fix this by moving the variables to
the outside scope.

Reported by coverty.
---
 src/rtnl.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/rtnl.c b/src/rtnl.c
index ace0461..0ad6bf6 100644
--- a/src/rtnl.c
+++ b/src/rtnl.c
@@ -624,18 +624,16 @@ static void process_newaddr(unsigned char family, 
unsigned char prefixlen,
 static void process_deladdr(unsigned char family, unsigned char prefixlen,
                                int index, struct ifaddrmsg *msg, int bytes)
 {
+       struct in_addr ipv4_addr = { INADDR_ANY };
+       struct in6_addr ipv6_address, ipv6_local;
        const char *label = NULL;
        void *src;
        char ip_string[INET6_ADDRSTRLEN];
 
        if (family == AF_INET) {
-               struct in_addr ipv4_addr = { INADDR_ANY };
-
                extract_ipv4_addr(msg, bytes, &label, &ipv4_addr, NULL, NULL);
                src = &ipv4_addr;
        } else if (family == AF_INET6) {
-               struct in6_addr ipv6_address, ipv6_local;
-
                extract_ipv6_addr(msg, bytes, &ipv6_address, &ipv6_local);
                if (IN6_IS_ADDR_LINKLOCAL(&ipv6_address))
                        return;
-- 
1.8.4.474.g128a96c

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

Reply via email to