]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: 51d: fix possible segfault on deinit_51degrees()
authorDragan Dosen <ddosen@haproxy.com>
Thu, 7 Mar 2019 14:24:23 +0000 (15:24 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 7 Mar 2019 16:16:27 +0000 (17:16 +0100)
When haproxy is built with 51Degrees support, but not configured to use
51Degrees database, a segfault can occur when deinit_51degrees()
function is called, eg. during soft-stop on SIGUSR1 signal.

Only builds that use Pattern algorithm are affected.

This fix must be backported to all stable branches where 51Degrees
support is available. Additional adjustments are required for some
branches due to API and naming changes.

src/51d.c

index 701709553bf4f47e5e9dee02d40a0631174836ed..c87525d6f3146dfa0930d249e4b736a99eb64e16 100644 (file)
--- a/src/51d.c
+++ b/src/51d.c
@@ -702,7 +702,8 @@ static void deinit_51degrees(void)
 
        free(global_51degrees.header_names);
 #ifdef FIFTYONEDEGREES_H_PATTERN_INCLUDED
-       fiftyoneDegreesWorksetPoolFree(global_51degrees.pool);
+       if (global_51degrees.pool)
+               fiftyoneDegreesWorksetPoolFree(global_51degrees.pool);
 #endif
 #ifdef FIFTYONEDEGREES_H_TRIE_INCLUDED
 #ifdef FIFTYONEDEGREES_NO_THREADING