threads / patch / 11658

patchhttp-push: fix double free()

Subject: [PATCH] http-push: fix double free()

## tl;dr

4 messages between Jan 17, 2008 and Jan 18, 2008. Diffs are folded; open one to read it.

replies: 3people: 2as markdown or json

Johannes Schindelin· Jan 17, 2008, 19:45 UTC · lore

There was an extra free(url) in remote_exists() (both if clauses before that contain a free(url) already), which resulted in a crash on Windows.

Noticed by Nigel Magnay.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
	This fixes Issue 71 of msysGit, as far as I can tell.
 http-push.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
Show changes to http-push.c +0 −1
diff --git a/http-push.c b/http-push.c
index 64be904..a78e0a9 100644
--- a/http-push.c
+++ b/http-push.c
@@ -1991,7 +1991,6 @@ static int remote_exists(const char *path)
 		fprintf(stderr, "Unable to start HEAD request\n");
 	}
 
-	free(url);
 	return ret;
 }
 
-- 
1.5.3.6.2304.gbc8e45-dirty
Mike Hommey· Jan 18, 2008, 06:34 UTC · re: Johannes Schindelin · lore

Re: [PATCH] http-push: fix double free()

On Thu, Jan 17, 2008 at 07:45:11PM +0000, Johannes Schindelin wrote:
> 
> There was an extra free(url) in remote_exists() (both if clauses before 
> that contain a free(url) already), which resulted in a crash on Windows.

Mmmmmm the free(url) you remove has been added in 3a462bc9 and the free(url) in the if clauses before have been removed in the same commit. I fail to see how that could lead to a double free().

Actually, I do see how, because git show 64be904 displays an obviously wrong remote_exists. OTOH, neither next, master nor pu have such code...

Mike
Johannes Schindelin· Jan 18, 2008, 12:14 UTC · re: Mike Hommey · lore

Re: [PATCH] http-push: fix double free()

Hi,
On Fri, 18 Jan 2008, Mike Hommey wrote:
Show 12 quoted lines
> On Thu, Jan 17, 2008 at 07:45:11PM +0000, Johannes Schindelin wrote:
> > 
> > There was an extra free(url) in remote_exists() (both if clauses 
> > before that contain a free(url) already), which resulted in a crash on 
> > Windows.
> 
> Mmmmmm the free(url) you remove has been added in 3a462bc9 and the 
> free(url) in the if clauses before have been removed in the same commit. 
> I fail to see how that could lead to a double free().
> 
> Actually, I do see how, because git show 64be904 displays an obviously 
> wrong remote_exists. OTOH, neither next, master nor pu have such code...

Ah, sorry. I was working on an old git branch, it seems. Will try with a newer one (to see if issue 71 persists).

Ciao, Dscho

Johannes Schindelin· Jan 18, 2008, 14:54 UTC · re: Mike Hommey · lore

Re: [PATCH] http-push: fix double free()

Hi,
On Fri, 18 Jan 2008, Mike Hommey wrote:
Show 8 quoted lines
> On Thu, Jan 17, 2008 at 07:45:11PM +0000, Johannes Schindelin wrote:
> > 
> > There was an extra free(url) in remote_exists() (both if clauses before 
> > that contain a free(url) already), which resulted in a crash on Windows.
> 
> Mmmmmm the free(url) you remove has been added in 3a462bc9 and the 
> free(url) in the if clauses before have been removed in the same commit. 
> I fail to see how that could lead to a double free().

Yes, I confirm that my "fix" is wrong, because it was based on an _obsolete_ source tree. Git-1.5.4-rc3-preview20080113.exe of msysGit appears not to have a problem with HTTP pushing.

Sorry for the noise, Dscho

← back to recent threads