[PATCH] Fix memory leak in dlopen()/dlclose().
Philip Craig
philipjcraig at gmail.com
Tue Feb 8 06:11:38 UTC 2011
The linked list of library dependencies created by dlopen() was not
being freed by dlclose().
Signed-off-by: Philip Craig <philipjcraig at gmail.com>
---
Tested with uClibc 0.9.29 only.
Code inspection shows the error is still present in latest git,
I compile tested there.
ldso/libdl/libdl.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/ldso/libdl/libdl.c b/ldso/libdl/libdl.c
index b88bc48..ee5cd44 100644
--- a/ldso/libdl/libdl.c
+++ b/ldso/libdl/libdl.c
@@ -922,6 +922,10 @@ static int do_dlclose(void *vhandle, int need_fini)
free(tpnt);
}
}
+ for (rpnt1 = handle->next; rpnt1; rpnt1 = rpnt1_tmp) {
+ rpnt1_tmp = rpnt1->next;
+ free(rpnt1);
+ }
free(handle->init_fini.init_fini);
free(handle);
--
1.7.0.4
More information about the uClibc
mailing list