]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: always initialize the answer_list
authorWilly Tarreau <w@1wt.eu>
Tue, 19 Oct 2021 09:29:21 +0000 (11:29 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 20 Oct 2021 15:53:54 +0000 (17:53 +0200)
Similar to the previous patch, the answer's list was only initialized the
first time it was added to a list, leading to bogus outdated pointer to
appear when debugging code is added around it to watch it. Let's make
sure it's always initialized upon allocation.

src/resolvers.c

index 564cd4992dd739c9659c876a7a4a18e5da7c98b3..7381e750e51c14c38f4777e0d65bc4b9e1bb2a9c 100644 (file)
@@ -991,6 +991,7 @@ static int resolv_validate_dns_response(unsigned char *resp, unsigned char *bufe
                answer_record->ar_item = NULL;
                answer_record->last_seen = TICK_ETERNITY;
                LIST_INIT(&answer_record->attached_servers);
+               LIST_INIT(&answer_record->list);
 
                offset = 0;
                len = resolv_read_name(resp, bufend, reader, tmpname, DNS_MAX_NAME_SIZE, &offset, 0);