From: Bill Parker Date: Mon, 13 Jul 2015 19:59:46 +0000 (-0700) Subject: Add checks for strdup() failure. X-Git-Tag: tcpdump-4.8.0~211 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/95d2a0d1ee80a9e1398417f4a5ea6b8c3cff06d3 Add checks for strdup() failure. --- diff --git a/print-atalk.c b/print-atalk.c index c5eb7800..09c0ff43 100644 --- a/print-atalk.c +++ b/print-atalk.c @@ -568,6 +568,8 @@ ataddr_string(netdissect_options *ndo, tp->addr = i2; tp->nxt = newhnamemem(); tp->name = strdup(nambuf); + if (tp->name == NULL) + error("ataddr_string: strdup(nambuf)"); } fclose(fp); } @@ -585,6 +587,8 @@ ataddr_string(netdissect_options *ndo, (void)snprintf(nambuf, sizeof(nambuf), "%s.%d", tp2->name, athost); tp->name = strdup(nambuf); + if (tp->name == NULL) + error("ataddr_string: strdup(nambuf)"); return (tp->name); } @@ -595,6 +599,8 @@ ataddr_string(netdissect_options *ndo, else (void)snprintf(nambuf, sizeof(nambuf), "%d", atnet); tp->name = strdup(nambuf); + if (tp->name == NULL) + error("ataddr_string: strdup(nambuf)"); return (tp->name); }