Skip to content

Commit 0caea90

Browse files
chriscoolJunio C Hamano
authored andcommitted
Fix memory leak in prepend_to_path (git.c).
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>
1 parent c41e20b commit 0caea90

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

git.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ static void prepend_to_path(const char *dir, int len)
3636
memcpy(path + len + 1, old_path, path_len - len);
3737

3838
setenv("PATH", path, 1);
39+
40+
free(path);
3941
}
4042

4143
static int handle_options(const char*** argv, int* argc)

0 commit comments

Comments
 (0)