Previously, the handle debuginfod_so created by dlopen was not closed 
in all cases, leading to a potential resource leak. This commit adds an 
additional dlclose call to ensure that the handle is always properly 
released, whether the symbols are successfully loaded or not.

Found by RASU JSC.

Signed-off-by: Maks Mishin <maks.mishi...@gmail.com>

---
 elfutils/libdwfl/debuginfod-client.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/elfutils/libdwfl/debuginfod-client.c 
b/elfutils/libdwfl/debuginfod-client.c
index ee604ad..8f67ecf 100644
--- a/elfutils/libdwfl/debuginfod-client.c
+++ b/elfutils/libdwfl/debuginfod-client.c
@@ -127,5 +127,8 @@ __libdwfl_debuginfod_init (void)
          fp_debuginfod_end = NULL;
          dlclose (debuginfod_so);
        }
+       else{
+      dlclose (debuginfod_so);
+    }
     }
 }
-- 
2.30.2

Reply via email to