Hi - On Fri, Nov 01, 2024 at 07:37:03PM +0300, Anton Moryakov wrote: > 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> > --- 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); > + }
This code looks broken. This dlclose's the shared library even in the successful dlopen/dlsym case, so subsequent calls through the fp_* function pointers will all fail. How has this been tested?! - FChE