From 077096259dafe6703d40f2265bad0819c24bfb12 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Sat, 4 Apr 2015 00:15:19 -0400 Subject: [PATCH] fix rpath string memory leak on failed dlopen when dlopen fails, all partially-loaded libraries need to be unmapped and freed. any of these libraries using an rpath with $ORIGIN expansion may have an allocated string for the expanded rpath; previously, this string was not freed when freeing the library data structures. --- src/ldso/dynlink.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c index 4a371839..f6ed8011 100644 --- a/src/ldso/dynlink.c +++ b/src/ldso/dynlink.c @@ -1413,6 +1413,8 @@ void *dlopen(const char *file, int mode) free(p->td_index); p->td_index = tmp; } + if (p->rpath != p->rpath_orig) + free(p->rpath); free(p->deps); free(p); } -- 2.25.1