]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: deinit: check fdtab before fdtab[fd].owner
authorWilly Tarreau <w@1wt.eu>
Wed, 14 Oct 2020 10:13:51 +0000 (12:13 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 14 Oct 2020 10:13:51 +0000 (12:13 +0200)
When running a pure config check (haproxy -c) we go through the deinit
phase without having allocated fdtab, so we can't blindly dereference
it. The issue was added by recent commit ae7bc4a23 ("MEDIUM: deinit:
close all receivers/listeners before scanning proxies"), no backport is
needed.

src/haproxy.c

index 3bdcba7b82d970ffcdbf4345ec401bf17d601880..4ef79bc27a18f0a66132b91e2acf54dd289d8b41 100644 (file)
@@ -2452,7 +2452,7 @@ void deinit(void)
        protocol_unbind_all();
 
        for (cur_fd = 0; cur_fd < global.maxsock; cur_fd++) {
-               if (!fdtab[cur_fd].owner)
+               if (!fdtab || !fdtab[cur_fd].owner)
                        continue;
 
                if (fdtab[cur_fd].iocb == listener_accept) {