X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=src%2Fcommon%2Futils.c;h=25639461cc3ae03e147ff0224364c4db21fb8876;hb=ef4a79b97e84065a8384ab5d628fbf8365cf9bba;hp=3e0058067fcd2b73bc42fe767c0e022b96b03b39;hpb=9a78c92e24e1f689a7fb0229516c6b1761615077;p=lttng-tools.git diff --git a/src/common/utils.c b/src/common/utils.c index 3e0058067..25639461c 100644 --- a/src/common/utils.c +++ b/src/common/utils.c @@ -52,7 +52,7 @@ LTTNG_HIDDEN char *utils_partial_realpath(const char *path, char *resolved_path, size_t size) { - char *cut_path, *try_path = NULL, *try_path_prev = NULL; + char *cut_path = NULL, *try_path = NULL, *try_path_prev = NULL; const char *next, *prev, *end; /* Safety net */ @@ -121,6 +121,7 @@ char *utils_partial_realpath(const char *path, char *resolved_path, size_t size) /* Free the allocated memory */ free(cut_path); + cut_path = NULL; }; /* Allocate memory for the resolved path if necessary */ @@ -171,6 +172,9 @@ char *utils_partial_realpath(const char *path, char *resolved_path, size_t size) error: free(resolved_path); + free(cut_path); + free(try_path); + free(try_path_prev); return NULL; } @@ -754,10 +758,6 @@ int utils_unlink_stream_file(const char *path_name, char *file_name, uint64_t si ret = unlink(path); } else { ret = run_as_unlink(path, uid, gid); - if (ret < 0) { - errno = -ret; - ret = -1; - } } if (ret < 0) { goto error;