DORMANTno replies

[PATCH] Fix memory leak in "connect.c".

From: Christian Couder <hidden>
Date: 2016-06-15 22:42:39
Subsystem: the rest · Maintainer: Linus Torvalds

sq_quote allocates some memory that should be freed.

Signed-off-by: Christian Couder <redacted>
---
 connect.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/connect.c b/connect.c
index 1c6429b..40a1c28 100644
--- a/connect.c
+++ b/connect.c
@@ -697,8 +697,9 @@ int git_connect(int fd[2], char *url, co
 	if (pid < 0)
 		die("unable to fork");
 	if (!pid) {
-		snprintf(command, sizeof(command), "%s %s", prog,
-			 sq_quote(path));
+		char *sq_path = sq_quote(path);
+		snprintf(command, sizeof(command), "%s %s", prog, sq_path);
+		free(sq_path);
 		dup2(pipefd[1][0], 0);
 		dup2(pipefd[0][1], 1);
 		close(pipefd[0][0]);
-- 
1.4.2.g1ccae49
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help