git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] transport-helper: remove duplicate free()
@ 2009-12-02  7:39 Tay Ray Chuan
  2009-12-02 16:23 ` Daniel Barkalow
  0 siblings, 1 reply; 4+ messages in thread
From: Tay Ray Chuan @ 2009-12-02  7:39 UTC (permalink / raw)
  To: git; +Cc: Daniel Barkalow, Sverre Rabbelier, Junio C Hamano

Remove the free() invocation on transport->data in release_helper(), as
disconnect_helper() has already done so.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
---

  Applies on top of 'next'.

 transport-helper.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/transport-helper.c b/transport-helper.c
index 9c5f860..2f77bd5 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -196,7 +196,6 @@ static int release_helper(struct transport *transport)
 	free_refspec(data->refspec_nr, data->refspecs);
 	data->refspecs = NULL;
 	disconnect_helper(transport);
-	free(transport->data);
 	return 0;
 }

--
1.6.6.rc0.306.g5bb1c0

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

* Re: [PATCH] transport-helper: remove duplicate free()
  2009-12-02  7:39 [PATCH] transport-helper: remove duplicate free() Tay Ray Chuan
@ 2009-12-02 16:23 ` Daniel Barkalow
  2009-12-02 19:06   ` Junio C Hamano
  2009-12-02 23:00   ` Tay Ray Chuan
  0 siblings, 2 replies; 4+ messages in thread
From: Daniel Barkalow @ 2009-12-02 16:23 UTC (permalink / raw)
  To: Tay Ray Chuan; +Cc: git, Sverre Rabbelier, Junio C Hamano

On Wed, 2 Dec 2009, Tay Ray Chuan wrote:

> Remove the free() invocation on transport->data in release_helper(), as
> disconnect_helper() has already done so.

You need to remove the one in disconnect_helper, because the entire point 
of disconnect_helper as opposed to release_helper is to *not* free that 
memory. If you remove this one, you'll access freed memory in any case 
where the helper has to be quit and restarted.

	-Daniel
*This .sig left intentionally blank*

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

* Re: [PATCH] transport-helper: remove duplicate free()
  2009-12-02 16:23 ` Daniel Barkalow
@ 2009-12-02 19:06   ` Junio C Hamano
  2009-12-02 23:00   ` Tay Ray Chuan
  1 sibling, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2009-12-02 19:06 UTC (permalink / raw)
  To: Daniel Barkalow; +Cc: Tay Ray Chuan, git, Sverre Rabbelier, Junio C Hamano

Daniel Barkalow <barkalow@iabervon.org> writes:

> On Wed, 2 Dec 2009, Tay Ray Chuan wrote:
>
>> Remove the free() invocation on transport->data in release_helper(), as
>> disconnect_helper() has already done so.
>
> You need to remove the one in disconnect_helper, because the entire point 
> of disconnect_helper as opposed to release_helper is to *not* free that 
> memory. If you remove this one, you'll access freed memory in any case 
> where the helper has to be quit and restarted.

Thanks.  I did two things:

 - Since the bottom commit cannot be rewritten (as it is based on the
   version that is before the change in the caller to free it), I queued a
   one liner to remove the free from the callee in 'next'.

 - The problem will surface when the series is later merged to 'master'.
   I told my rerere database about the necessity of this "evil merge", so
   that we will automatically have the equivalent of the one-liner when it
   happens.

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

* Re: [PATCH] transport-helper: remove duplicate free()
  2009-12-02 16:23 ` Daniel Barkalow
  2009-12-02 19:06   ` Junio C Hamano
@ 2009-12-02 23:00   ` Tay Ray Chuan
  1 sibling, 0 replies; 4+ messages in thread
From: Tay Ray Chuan @ 2009-12-02 23:00 UTC (permalink / raw)
  To: Daniel Barkalow; +Cc: git, Sverre Rabbelier, Junio C Hamano

Hi,

On Thu, Dec 3, 2009 at 12:23 AM, Daniel Barkalow <barkalow@iabervon.org> wrote:
> You need to remove the one in disconnect_helper, because the entire point
> of disconnect_helper as opposed to release_helper is to *not* free that
> memory. If you remove this one, you'll access freed memory in any case
> where the helper has to be quit and restarted.

I see. I guess I should have looked more closely at f2a3715 (Fix
memory leak in helper method for disconnect).

-- 
Cheers,
Ray Chuan

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

end of thread, other threads:[~2009-12-02 23:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-02  7:39 [PATCH] transport-helper: remove duplicate free() Tay Ray Chuan
2009-12-02 16:23 ` Daniel Barkalow
2009-12-02 19:06   ` Junio C Hamano
2009-12-02 23:00   ` Tay Ray Chuan

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