Hi, On Mon, 19 Feb 2007, Junio C Hamano wrote: > Johannes Schindelin <Johannes.Schindelin@xxxxxx> writes: > > > This is on top of them. > > I am not sure if this is correct. Don't we do some point > new_name = old_name = blah? Yes, you're right. I missed that. The change is in the last hunk: -- [PATCH] apply: fix memory leak in prefix_one() Signed-off-by: Johannes Schindelin <Johannes.Schindelin@xxxxxx> --- builtin-apply.c | 15 +++++++++------ 1 files changed, 9 insertions(+), 6 deletions(-) diff --git a/builtin-apply.c b/builtin-apply.c index e01969f..2a23138 100644 --- a/builtin-apply.c +++ b/builtin-apply.c @@ -2516,11 +2516,13 @@ static int use_patch(struct patch *p) return 1; } -static char *prefix_one(char *name) +static void prefix_one(char **name) { - if (!name) - return name; - return xstrdup(prefix_filename(prefix, prefix_length, name)); + char *old_name = *name; + if (!old_name) + return; + *name = xstrdup(prefix_filename(prefix, prefix_length, *name)); + free(old_name); } static void prefix_patches(struct patch *p) @@ -2528,8 +2530,9 @@ static void prefix_patches(struct patch *p) if (!prefix) return; for ( ; p; p = p->next) { - p->new_name = prefix_one(p->new_name); - p->old_name = prefix_one(p->old_name); + if (p->new_name != p->old_name) + prefix_one(&p->new_name); + prefix_one(&p->old_name); } } -- 1.5.0.1.2141.gc066 - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html