[PATCH 0/2] Command preparation cleanup in "connect.c" (was: [PATCH] Fix memory leak in "connect.c".)

From: Christian Couder <chriscool@tuxfamily.org>
Date: 2006-09-11 14:43:12
Le jeudi 7 septembre 2006 06:09, Junio C Hamano a écrit :
> Christian Couder <chriscool@tuxfamily.org> writes:
> > sq_quote allocates some memory that should be freed.
>
> That's technically correct, but the code you are touching is
> immediately before exec() or die() so I chose to be sloppy and
> short ;-).
>
> With sq_quote_buf() (which was introduced with 77d604 Oct 10
> 2005), you should be able to directly write into the command[]
> buffer, I think.  The code you touched predates that function
> (b10d0e July 8 2005).

The following two patches clean "connect.c" up using "add_to_string" 
from "rsh.c". The code is still longer, but there is no leak and it may be 
better to die with an error message than to truncate a too long command.

Shortlog:
	[PATCH 1/2] Move add_to_string to "quote.c" and make it extern.
	[PATCH 2/2] Fix a memory leak in "connect.c" and die if command too
long.

Diffstat:
 connect.c |   17 ++++++++++++++---
 quote.c   |   29 +++++++++++++++++++++++++++++
 quote.h   |    6 ++++++
 rsh.c     |   29 -----------------------------
 4 files changed, 49 insertions(+), 32 deletions(-)

Christian.
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Mon Sep 11 14:37:35 2006

This archive was generated by hypermail 2.1.8 : 2006-09-11 14:38:13 EST