]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Ensure our configured routes are allocated correctly.
authorRoy Marples <roy@marples.name>
Thu, 26 Mar 2015 19:49:59 +0000 (19:49 +0000)
committerRoy Marples <roy@marples.name>
Thu, 26 Mar 2015 19:49:59 +0000 (19:49 +0000)
if-options.c

index e09310de214759dfa7cdb3a6cd0d4b13e950a152..19bfc2131da0e6d05dfe387cb78f78e720f43b6c 100644 (file)
@@ -1038,7 +1038,7 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo,
                                }
                                TAILQ_INIT(ifo->routes);
                        }
-                       rt = malloc(sizeof(*rt));
+                       rt = calloc(1, sizeof(*rt));
                        if (rt == NULL) {
                                logger(ctx, LOG_ERR, "%s: %m", __func__);
                                *fp = ' ';
@@ -1063,7 +1063,7 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo,
                                }
                                TAILQ_INIT(ifo->routes);
                        }
-                       rt = malloc(sizeof(*rt));
+                       rt = calloc(1, sizeof(*rt));
                        if (rt == NULL) {
                                logger(ctx, LOG_ERR, "%s: %m", __func__);
                                return -1;