[git commit master 1/1] Fix memory leak in dlopen()/dlclose().

Bernhard Reutner-Fischer rep.dot.nop at gmail.com
Fri Feb 11 18:30:17 UTC 2011


commit: http://git.uclibc.org/uClibc/commit/?id=bb8551685e2efc42c65a01479b9f9bb8b860da01
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/master

The linked list of library dependencies created by dlopen() was not
being freed by dlclose().

Signed-off-by: Philip Craig <philipjcraig at gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>
---
 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.3.4



More information about the uClibc-cvs mailing list