1 From ea6cc338042094f8023d224e53c244da158e6499 Mon Sep 17 00:00:00 2001
2 From: Simon Kelley <simon@thekelleys.org.uk>
3 Date: Tue, 18 Sep 2018 23:21:17 +0100
4 Subject: [PATCH] Handle memory allocation failure in make_non_terminals()
6 Thanks to Kristian Evensen for spotting the problem.
8 Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
10 src/cache.c | 17 ++++++++++-------
11 1 file changed, 10 insertions(+), 7 deletions(-)
15 @@ -1360,7 +1360,7 @@ void cache_add_dhcp_entry(char *host_nam
16 static void make_non_terminals(struct crec *source)
18 char *name = cache_get_name(source);
19 - struct crec* crecp, *tmp, **up;
20 + struct crec *crecp, *tmp, **up;
21 int type = F_HOSTS | F_CONFIG;
23 if (source->flags & F_DHCP)
24 @@ -1434,12 +1434,15 @@ static void make_non_terminals(struct cr
26 crecp = whine_malloc(sizeof(struct crec));
29 - crecp->flags &= ~(F_IPV4 | F_IPV6 | F_CNAME | F_DNSKEY | F_DS | F_REVERSE);
30 - crecp->flags |= F_NAMEP;
31 - crecp->name.namep = name;
37 + crecp->flags &= ~(F_IPV4 | F_IPV6 | F_CNAME | F_DNSKEY | F_DS | F_REVERSE);
38 + crecp->flags |= F_NAMEP;
39 + crecp->name.namep = name;