git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] builtin-rerere: fix a small leak
@ 2008-06-17  7:23 Junio C Hamano
  2008-06-17 10:34 ` Johannes Schindelin
  0 siblings, 1 reply; 2+ messages in thread
From: Junio C Hamano @ 2008-06-17  7:23 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git

The data read from MERGE_RR file is kept in path-list by hanging textual
40-byte conflict signature to path of the blob that contains the
conflict.  The signature is strdup'ed twice, and the second copy is given
to the path-list, leaking the first copy.

Signed-off-by: Junio C Hamano <junio@pobox.com>
---
 * Am I overlooking something obvious, or is this simply a never-reviewed
   buglet that nobody has noticed for a long time?

 builtin-rerere.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/builtin-rerere.c b/builtin-rerere.c
index 5c81142..85222d9 100644
--- a/builtin-rerere.c
+++ b/builtin-rerere.c
@@ -43,7 +43,7 @@ static void read_rr(struct path_list *rr)
 			; /* do nothing */
 		if (i == sizeof(buf))
 			die("filename too long");
-		path_list_insert(buf, rr)->util = xstrdup(name);
+		path_list_insert(buf, rr)->util = name;
 	}
 	fclose(in);
 }

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

* Re: [PATCH] builtin-rerere: fix a small leak
  2008-06-17  7:23 [PATCH] builtin-rerere: fix a small leak Junio C Hamano
@ 2008-06-17 10:34 ` Johannes Schindelin
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Schindelin @ 2008-06-17 10:34 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Hi,

On Tue, 17 Jun 2008, Junio C Hamano wrote:

> The data read from MERGE_RR file is kept in path-list by hanging textual
> 40-byte conflict signature to path of the blob that contains the
> conflict.  The signature is strdup'ed twice, and the second copy is given
> to the path-list, leaking the first copy.
> 
> Signed-off-by: Junio C Hamano <junio@pobox.com>
> ---
>  * Am I overlooking something obvious, or is this simply a never-reviewed
>    buglet that nobody has noticed for a long time?

I think that it was a never-reviewed buglet.  The only code path leading 
to read_rr passes merge_rr, which has strdup_paths == 1.

Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>

Ciao,
Dscho

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

end of thread, other threads:[~2008-06-17 10:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-17  7:23 [PATCH] builtin-rerere: fix a small leak Junio C Hamano
2008-06-17 10:34 ` Johannes Schindelin

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).