From b2c8336a02528a26402d9fc7c5de74b739cf6a37 Mon Sep 17 00:00:00 2001 From: Antoine Busque Date: Sun, 13 Sep 2015 00:18:44 -0400 Subject: [PATCH] Fix: memleak in utils_partial_realpath MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Antoine Busque Signed-off-by: Jérémie Galarneau --- src/common/utils.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/common/utils.c b/src/common/utils.c index 7a09259eb..d4ff94c7a 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 */ @@ -171,6 +171,7 @@ char *utils_partial_realpath(const char *path, char *resolved_path, size_t size) error: free(resolved_path); + free(cut_path); return NULL; } -- 2.34.1