aboutsummaryrefslogtreecommitdiff
path: root/src/rpath.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/rpath.c')
-rw-r--r--src/rpath.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/rpath.c b/src/rpath.c
index a6b6b6c..04d810e 100644
--- a/src/rpath.c
+++ b/src/rpath.c
@@ -128,10 +128,13 @@ char *rpath_generate(const char *_filename) {
}
char *nearest_lib = rpath_autodetect(filename);
if (!nearest_lib) {
+ free(filename);
return NULL;
}
char *result = (char *)calloc(strlen(origin) + strlen(nearest_lib) + 1, sizeof(char));
if (!result) {
+ free(filename);
+ free(nearest_lib);
return NULL;
}
sprintf(result, "%s%s", origin, nearest_lib);
@@ -227,10 +230,12 @@ char *rpath_autodetect(const char *filename) {
if (access(tmp, F_OK) == 0) {
strcat(relative, "lib");
has_real_libdir = 1; // gate for memory allocation below
+ free(visit);
break;
}
// Reaching the top of the file system indicates our search for a lib directory failed
else if (strcmp(visit, "/") == 0) {
+ free(visit);
break;
}