]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: Call deinit_and_exit(0) for `haproxy -vv`
authorTim Duesterhus <tim@bastelstu.be>
Tue, 26 Apr 2022 22:08:11 +0000 (00:08 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 27 Apr 2022 03:01:27 +0000 (05:01 +0200)
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.

src/haproxy.c

index 6fbe85bd3c084448cde184fb0ca06f894db78895..b43997b6c5c87f955d511c13309a1d36eac47f6f 100644 (file)
@@ -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')