debuginfod: Fix debuginfod_pool leak

Message ID 20211204213335.277073-1-mark@klomp.org
State Committed
Headers
Series debuginfod: Fix debuginfod_pool leak |

Commit Message

Mark Wielaard Dec. 4, 2021, 9:33 p.m. UTC
  gcc address sanitizer detected a dangling debuginfod_client handler
when debuginfod exits. Make sure to groom the debuginfod client pool
before exit after all threads are done.

Signed-off-by: Mark Wielaard <mark@klomp.org>
---
 debuginfod/ChangeLog      | 4 ++++
 debuginfod/debuginfod.cxx | 2 ++
 2 files changed, 6 insertions(+)
  

Comments

Mark Wielaard Dec. 8, 2021, 11:25 p.m. UTC | #1
On Sat, Dec 04, 2021 at 10:33:35PM +0100, Mark Wielaard wrote:
> gcc address sanitizer detected a dangling debuginfod_client handler
> when debuginfod exits. Make sure to groom the debuginfod client pool
> before exit after all threads are done.

Pushed,

Mark
  

Patch

diff --git a/debuginfod/ChangeLog b/debuginfod/ChangeLog
index 822bd637..c9253d6c 100644
--- a/debuginfod/ChangeLog
+++ b/debuginfod/ChangeLog
@@ -1,3 +1,7 @@ 
+2021-12-04  Mark Wielaard  <mark@klomp.org>
+
+	* debuginfod.cxx (main): Call debuginfod_pool_groom before exit.
+
 2021-11-10  Érico N. Rolim  <erico.erc@gmail.com>
 
 	* debuginfod.cxx: include "system.h" under 'extern "C"' block.
diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx
index 764e7b94..bb8322db 100644
--- a/debuginfod/debuginfod.cxx
+++ b/debuginfod/debuginfod.cxx
@@ -3994,6 +3994,8 @@  main (int argc, char *argv[])
         }
     }
 
+  debuginfod_pool_groom ();
+
   // NB: no problem with unconditional free here - an earlier failed regcomp would exit program
   (void) regfree (& file_include_regex);
   (void) regfree (& file_exclude_regex);