statzone

DNS zone file analyzer targeted at TLD zones
Log | Files | Refs | README | LICENSE

commit f839c5bcdcb52a7363ff8331d7e286f97d99451d
parent 9cd0a7d91285aed9f9cd3945a133b8a2cb029686
Author: Frederic Cambus <fred@statdns.com>
Date:   Mon,  8 Feb 2021 15:25:40 +0100

Check malloc() return value and error out on failed allocations.

Diffstat:
Msrc/statzone.c | 6++++++
1 file changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/statzone.c b/src/statzone.c @@ -200,6 +200,9 @@ main(int argc, char *argv[]) if (!ds) { ds = malloc(sizeof (struct my_struct)); + if (ds == NULL) + error("Memory allocation error."); + ds->domain = strdup(domain); HASH_ADD_STR(signed_domains, domain, ds); } @@ -228,6 +231,9 @@ main(int argc, char *argv[]) if (!ns) { ns = malloc(sizeof (struct my_struct)); + if (ns == NULL) + error("Memory allocation error."); + ns->domain = strdup(rdata); HASH_ADD_STR(unique_ns, domain, ns); }