]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Ensure we have correct memory allocation for number of prefixes.
authorRoy Marples <roy@marples.name>
Thu, 30 Aug 2012 16:26:38 +0000 (16:26 +0000)
committerRoy Marples <roy@marples.name>
Thu, 30 Aug 2012 16:26:38 +0000 (16:26 +0000)
ipv6rs.c

index 4d2bd2444e9c1c2a2c6ec178aa9652ce7d846e4b..3a8dd691bd02b120c89631ee5a2c8bc3bf24efd9 100644 (file)
--- a/ipv6rs.c
+++ b/ipv6rs.c
@@ -759,15 +759,9 @@ ipv6rs_env(char **env, const char *prefix, const struct interface *ifp)
                TAILQ_FOREACH(rao, &rap->options, next) {
                        if (rao->option == NULL)
                                continue;
-                       if (env == NULL) {
-                               switch (rao->type) {
-                               case ND_OPT_PREFIX_INFORMATION:
-                                       break;
-                               default:
-                                       l++;
-                               }
+                       l++;
+                       if (env == NULL)
                                continue;
-                       }
                        switch (rao->type) {
                        case ND_OPT_PREFIX_INFORMATION:
                                optn = "prefix";
@@ -786,7 +780,6 @@ ipv6rs_env(char **env, const char *prefix, const struct interface *ifp)
                        }
                        snprintf(buffer, sizeof(buffer), "ra%d_%s", i, optn);
                        setvar(&env, prefix, buffer, rao->option);
-                       l++;
                }
        }