ip-address-access: let's exit the loop after invalidating our entry a (#7803)
authorLennart Poettering <lennart@poettering.net>
Thu, 4 Jan 2018 12:24:40 +0000 (13:24 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 4 Jan 2018 12:24:40 +0000 (13:24 +0100)
CID#1382967

src/core/ip-address-access.c

index 8d72fc0..08bd4c0 100644 (file)
@@ -210,13 +210,12 @@ IPAddressAccessItem* ip_address_access_reduce(IPAddressAccessItem *first) {
                                                   &b->address,
                                                   b->prefixlen,
                                                   &a->address);
-                        if (r <= 0)
-                                continue;
-
-                        /* b covers a fully, then let's drop a */
-
-                        LIST_REMOVE(items, first, a);
-                        free(a);
+                        if (r > 0) {
+                                /* b covers a fully, then let's drop a */
+                                LIST_REMOVE(items, first, a);
+                                free(a);
+                                break;
+                        }
                 }
         }