소스 검색

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.
Rich Felker 10 년 전
부모
커밋
077096259d
1개의 변경된 파일2개의 추가작업 그리고 0개의 파일을 삭제
  1. 2 0
      src/ldso/dynlink.c

+ 2 - 0
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);
 		}