BUG/MEDIUM: 51d: fix possible segfault on deinit_51degrees()

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.
This commit is contained in:
Dragan Dosen 2019-03-07 15:24:23 +01:00 committed by Willy Tarreau
parent 2365fb0c97
commit bc6218e1b0

View File

@ -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