summaryrefslogtreecommitdiff
path: root/src/ldso
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2015-04-04 00:15:19 -0400
committerRich Felker <dalias@aerifal.cx>2015-04-04 00:15:19 -0400
commit077096259dafe6703d40f2265bad0819c24bfb12 (patch)
treea5e07d3c17dbad613ee8c3aa454a89dfb3cd01ea /src/ldso
parent2963a9f79406c829d5fd710a2e8fe510ee83c006 (diff)
downloadmusl-077096259dafe6703d40f2265bad0819c24bfb12.tar.gz
musl-077096259dafe6703d40f2265bad0819c24bfb12.tar.bz2
musl-077096259dafe6703d40f2265bad0819c24bfb12.tar.xz
musl-077096259dafe6703d40f2265bad0819c24bfb12.zip
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.
Diffstat (limited to 'src/ldso')
-rw-r--r--src/ldso/dynlink.c2
1 files changed, 2 insertions, 0 deletions
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);
}