diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2020-01-28 10:39:12 -0500 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2020-01-28 10:39:12 -0500 |
commit | 8b06e3e66a4cf26c02f9e0175263e1a561186c1b (patch) | |
tree | 8bac5ec5215066ef1fdff4edfd06857324b40f91 /src/rpath.c | |
parent | 38ef2cc6dff14f37050ea40ae62e4aea9863c805 (diff) | |
download | spmc-8b06e3e66a4cf26c02f9e0175263e1a561186c1b.tar.gz |
Remove md5sum function
* Fix a few glaring memory leaks
Diffstat (limited to 'src/rpath.c')
-rw-r--r-- | src/rpath.c | 5 |
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; } |