Fix: memleak in utils_partial_realpath
authorAntoine Busque <abusque@efficios.com>
Sun, 13 Sep 2015 04:18:44 +0000 (00:18 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 15 Sep 2015 17:21:40 +0000 (13:21 -0400)
Signed-off-by: Antoine Busque <abusque@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/common/utils.c

index d7811bd7a6fd566e992c505a1d81770aa1790b18..2f4ec903a2f9b849f1d0c32121400dfda5368844 100644 (file)
@@ -55,7 +55,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 */
@@ -174,6 +174,7 @@ char *utils_partial_realpath(const char *path, char *resolved_path, size_t size)
 
 error:
        free(resolved_path);
+       free(cut_path);
        return NULL;
 }
 
This page took 0.027427 seconds and 5 git commands to generate.