]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Log each malloc failure because we log individual failures so we don't see
authorRoy Marples <roy@marples.name>
Mon, 2 Jun 2014 23:30:50 +0000 (23:30 +0000)
committerRoy Marples <roy@marples.name>
Mon, 2 Jun 2014 23:30:50 +0000 (23:30 +0000)
any Success error messages on an invalid condition.

ipv6nd.c

index 0e6f7a95cac67548b8342b9f4504272cc06de0c2..43005be585626ce67d15dbfc4acf1ebaa18b5f54 100644 (file)
--- a/ipv6nd.c
+++ b/ipv6nd.c
@@ -909,9 +909,13 @@ ipv6nd_handlera(struct ipv6_ctx *ctx, struct interface *ifp,
                                        opt = tmp;
                                        opt[l - 1] = ' ';
                                        strlcpy(opt + l, ap->saddr, m);
-                               }
-                       } else
+                               } else
+                                       syslog(LOG_ERR, "%s: %m", __func__);
+                       } else {
                                opt = strdup(ap->saddr);
+                               if (opt == NULL)
+                                       syslog(LOG_ERR, "%s: %m", __func__);
+                       }
                        lifetime = ap->prefix_vltime;
                        break;
 
@@ -926,6 +930,8 @@ ipv6nd_handlera(struct ipv6_ctx *ctx, struct interface *ifp,
                        rap->mtu = mtuv;
                        snprintf(buf, sizeof(buf), "%d", mtuv);
                        opt = strdup(buf);
+                       if (opt == NULL)
+                               syslog(LOG_ERR, "%s: %m", __func__);
                        break;
 
                case ND_OPT_RDNSS:
@@ -964,7 +970,8 @@ ipv6nd_handlera(struct ipv6_ctx *ctx, struct interface *ifp,
                                        (*--tmp) = '\0';
                                else
                                        *opt = '\0';
-                       }
+                       } else
+                               syslog(LOG_ERR, "%s: %m", __func__);
                        break;
 
                case ND_OPT_DNSSL:
@@ -990,8 +997,12 @@ ipv6nd_handlera(struct ipv6_ctx *ctx, struct interface *ifp,
                                        if (opt)
                                                print_string(opt, n,
                                                    (const uint8_t *)tmp, l);
+                                       else
+                                               syslog(LOG_ERR, "%s: %m",
+                                                   __func__);
                                        free(tmp);
-                               }
+                               } else
+                                       syslog(LOG_ERR, "%s: %m", __func__);
                        }
                        break;
 
@@ -999,10 +1010,9 @@ ipv6nd_handlera(struct ipv6_ctx *ctx, struct interface *ifp,
                        continue;
                }
 
-               if (opt == NULL) {
-                       syslog(LOG_ERR, "%s: %m", __func__);
+               if (opt == NULL)
                        continue;
-               }
+
                TAILQ_FOREACH(rao, &rap->options, next) {
                        if (rao->type == ndo->nd_opt_type &&
                            strcmp(rao->option, opt) == 0)