git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Miklos Vajna <vmiklos@frugalware.org>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 1/4] builtin-clone: fix a memory leak in cmd_clone()
Date: Sun, 23 Nov 2008 19:51:36 -0800	[thread overview]
Message-ID: <7vabbpok6v.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <6bd31bceb3840f14d747972b4858e1c5b215744d.1227227976.git.vmiklos@frugalware.org> (Miklos Vajna's message of "Fri, 21 Nov 2008 01:44:58 +0100")

Miklos Vajna <vmiklos@frugalware.org> writes:

> Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
> ---
>  builtin-clone.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/builtin-clone.c b/builtin-clone.c
> index 8e1a1d3..da21cab 100644
> --- a/builtin-clone.c
> +++ b/builtin-clone.c
> @@ -516,6 +516,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
>  		refs = transport_get_remote_refs(transport);
>  		transport_fetch_refs(transport, refs);
>  	}
> +	free(dir);
>  
>  	clear_extra_refs();

Can't this be done much earlier?  This variable can potentially be
assigned to work_tree, but after we set up the atexit handler neither dir
nor work_tree are not used (it is a bit hard to see as this function
itself is a bit too big to be maintainable).

  parent reply	other threads:[~2008-11-24  3:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-21  0:44 [PATCH 0/4] builtin-clone: use strbuf Miklos Vajna
2008-11-21  0:44 ` [PATCH 1/4] builtin-clone: fix a memory leak in cmd_clone() Miklos Vajna
2008-11-21  0:44   ` [PATCH 2/4] builtin-clone: use strbuf in guess_dir_name() Miklos Vajna
2008-11-21  0:45     ` [PATCH 3/4] builtin-clone: use strbuf in clone_local() and copy_or_link_directory() Miklos Vajna
2008-11-21  0:45       ` [PATCH 4/4] builtin_clone: use strbuf in cmd_clone() Miklos Vajna
2008-11-24  3:51   ` Junio C Hamano [this message]
2008-11-25 22:40     ` [PATCH 1/4] builtin-clone: fix a memory leak " Miklos Vajna

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vabbpok6v.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=vmiklos@frugalware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).