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

4 messages from 2008-01-17 to 2008-01-18. Participants: Johannes Schindelin, Mike Hommey.
Thread: https://gitlist.dev/t/11658

## Johannes Schindelin, 2008-01-17 19:45

Subject: [PATCH] http-push: fix double free()
Message-ID: <alpine.LSU.1.00.0801171943360.5731@racer.site>
URL: https://gitlist.dev/e/alpine.LSU.1.00.0801171943360.5731%40racer.site

```

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

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, 2008-01-18 06:34

Subject: Re: [PATCH] http-push: fix double free()
Message-ID: <20080118063417.GB22089@glandium.org>
URL: https://gitlist.dev/e/20080118063417.GB22089%40glandium.org
In-Reply-To: <alpine.LSU.1.00.0801171943360.5731@racer.site>

```
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, 2008-01-18 12:14

Subject: Re: [PATCH] http-push: fix double free()
Message-ID: <alpine.LSU.1.00.0801181213220.5731@racer.site>
URL: https://gitlist.dev/e/alpine.LSU.1.00.0801181213220.5731%40racer.site
In-Reply-To: <20080118063417.GB22089@glandium.org>

```
Hi,

On Fri, 18 Jan 2008, Mike Hommey wrote:

> 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, 2008-01-18 14:54

Subject: Re: [PATCH] http-push: fix double free()
Message-ID: <alpine.LSU.1.00.0801181454400.5731@racer.site>
URL: https://gitlist.dev/e/alpine.LSU.1.00.0801181454400.5731%40racer.site
In-Reply-To: <20080118063417.GB22089@glandium.org>

```
Hi,

On Fri, 18 Jan 2008, Mike Hommey wrote:

> 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

```
