From: Tim Duesterhus Date: Tue, 26 Apr 2022 22:08:11 +0000 (+0200) Subject: MINOR: Call deinit_and_exit(0) for `haproxy -vv` X-Git-Tag: v2.6-dev8~58 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=77b3db0fbd3fcc2f589d3e9e4c39097b8831a581;p=thirdparty%2Fhaproxy.git MINOR: Call deinit_and_exit(0) for `haproxy -vv` It appears that it is safe to call perform a clean deinit at this point, so let's do this to exercise the deinit paths some more. Running `valgrind --leak-check=full --show-leak-kinds=all ./haproxy -vv` with this change reports: ==261864== HEAP SUMMARY: ==261864== in use at exit: 344 bytes in 11 blocks ==261864== total heap usage: 1,178 allocs, 1,167 frees, 1,102,089 bytes allocated ==261864== ==261864== 24 bytes in 1 blocks are still reachable in loss record 1 of 2 ==261864== at 0x483DD99: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so) ==261864== by 0x324BA6: hap_register_pre_check (init.c:92) ==261864== by 0x155824: main (haproxy.c:3024) ==261864== ==261864== 320 bytes in 10 blocks are still reachable in loss record 2 of 2 ==261864== at 0x483DD99: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so) ==261864== by 0x26E54E: cfg_register_postparser (cfgparse.c:4238) ==261864== by 0x155824: main (haproxy.c:3024) ==261864== ==261864== LEAK SUMMARY: ==261864== definitely lost: 0 bytes in 0 blocks ==261864== indirectly lost: 0 bytes in 0 blocks ==261864== possibly lost: 0 bytes in 0 blocks ==261864== still reachable: 344 bytes in 11 blocks ==261864== suppressed: 0 bytes in 0 blocks which is looking pretty good. --- diff --git a/src/haproxy.c b/src/haproxy.c index 6fbe85bd3c..b43997b6c5 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -1608,7 +1608,7 @@ static void init_args(int argc, char **argv) display_version(); if (flag[1] == 'v') /* -vv */ display_build_opts(); - exit(0); + deinit_and_exit(0); } #if defined(USE_EPOLL) else if (*flag == 'd' && flag[1] == 'e')