[PATCH] debuginfod-client.c: add dlclose call to prevent resource leak
Anton Moryakov
ant.v.moryakov@gmail.com
Fri Nov 1 16:37:03 GMT 2024
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.mishinFZ@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
More information about the Elfutils-devel
mailing list