You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.4 KiB

  1. commit 63f5dbf1b9fcdc5b10537d733b0e0798905ff1dc
  2. Author: Dragan Dosen <ddosen@haproxy.com>
  3. Date: Thu Mar 7 15:24:23 2019 +0100
  4. BUG/MEDIUM: 51d: fix possible segfault on deinit_51degrees()
  5. When haproxy is built with 51Degrees support, but not configured to use
  6. 51Degrees database, a segfault can occur when deinit_51degrees()
  7. function is called, eg. during soft-stop on SIGUSR1 signal.
  8. Only builds that use Pattern algorithm are affected.
  9. This fix must be backported to all stable branches where 51Degrees
  10. support is available. Additional adjustments are required for some
  11. branches due to API and naming changes.
  12. (cherry picked from commit bc6218e1b02860c6cdad0d2bb4dc8874557087f8)
  13. Signed-off-by: William Lallemand <wlallemand@haproxy.org>
  14. (cherry picked from commit 4e0363e84cb3f6ca341e1f83c6fd490c76c9ae6b)
  15. Signed-off-by: William Lallemand <wlallemand@haproxy.org>
  16. diff --git a/src/51d.c b/src/51d.c
  17. index a36333ef..03101136 100644
  18. --- a/src/51d.c
  19. +++ b/src/51d.c
  20. @@ -639,7 +639,8 @@ static void deinit_51degrees(void)
  21. free(global_51degrees.header_names);
  22. #ifdef FIFTYONEDEGREES_H_PATTERN_INCLUDED
  23. - fiftyoneDegreesWorksetPoolFree(global_51degrees.pool);
  24. + if (global_51degrees.pool)
  25. + fiftyoneDegreesWorksetPoolFree(global_51degrees.pool);
  26. #endif
  27. #ifdef FIFTYONEDEGREES_H_TRIE_INCLUDED
  28. free(global_51degrees.device_offsets.firstOffset);