git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix memory leak in "connect.c".
@ 2006-09-07  3:59 Christian Couder
  2006-09-07  4:09 ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Christian Couder @ 2006-09-07  3:59 UTC (permalink / raw)
  To: Junio Hamano; +Cc: git

sq_quote allocates some memory that should be freed.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
 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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-09-11  6:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-07  3:59 [PATCH] Fix memory leak in "connect.c" Christian Couder
2006-09-07  4:09 ` Junio C Hamano
2006-09-11  4:43   ` [PATCH 0/2] Command preparation cleanup in "connect.c" (was: [PATCH] Fix memory leak in "connect.c".) Christian Couder
2006-09-11  4:59     ` [PATCH 1/2] Move add_to_string to "quote.c" and make it extern Christian Couder
2006-09-11  5:04       ` [PATCH 2/2] Fix a memory leak in "connect.c" and die if command too long Christian Couder
2006-09-11  6:03     ` [PATCH 0/2] Command preparation cleanup in "connect.c" Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).