Fix memory leak in prepend_to_path (git.c).
authorChristian Couder <chriscool@tuxfamily.org>
Tue, 5 Sep 2006 06:22:16 +0000 (08:22 +0200)
committerJunio C Hamano <junkio@cox.net>
Wed, 6 Sep 2006 00:40:49 +0000 (17:40 -0700)
Some memory was allocated for a new path but not freed
after the path was used.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
git.c
diff --git a/git.c b/git.c
index 1d00111819f69cb4495be582bebee95be73ab214..335f405c20b3b07af5bb2e96dd00a75eb47ff809 100644 (file)
--- a/git.c
+++ b/git.c
@@ -36,6 +36,8 @@ static void prepend_to_path(const char *dir, int len)
        memcpy(path + len + 1, old_path, path_len - len);
 
        setenv("PATH", path, 1);
+
+       free(path);
 }
 
 static int handle_options(const char*** argv, int* argc)