]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: dns: don't randomly crash on out-of-memory
authorWilly Tarreau <w@1wt.eu>
Sat, 1 Oct 2016 07:20:32 +0000 (09:20 +0200)
committerWilly Tarreau <w@1wt.eu>
Sat, 1 Oct 2016 07:23:04 +0000 (09:23 +0200)
dns_init_resolvers() tries to emit the current resolver's name in the
error message in case of out-of-memory condition. But it must not do
it when initializing the trash before even having such a resolver
otherwise the user is certain to get a dirty crash instead of the
error message. No backport is needed.

src/dns.c

index fc9354ed550955b5c9fa8c83ded4b25ba5e6ac51..f21c50807d381ef81d7311f1ecc44a0d50fa7bb9 100644 (file)
--- a/src/dns.c
+++ b/src/dns.c
@@ -928,7 +928,7 @@ int dns_init_resolvers(void)
 
        dns_trash_str = malloc(global.tune.bufsize);
        if (dns_trash_str == NULL) {
-               Alert("Starting [%s] resolvers: out of memory.\n", curr_resolvers->id);
+               Alert("Starting resolvers: out of memory.\n");
                return 0;
        }