[PATCH] debuginfod: Fix debuginfod_pool leak

Mark Wielaard mark@klomp.org
Sat Dec 4 21:33:35 GMT 2021


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(+)

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);
-- 
2.30.2



More information about the Elfutils-devel mailing list