git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Sixt <j.sixt@viscovery.net>
To: David Rydh <dary@math.berkeley.edu>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH] git-mv: Fix error with multiple sources.
Date: Fri, 22 Jan 2010 08:29:26 +0100	[thread overview]
Message-ID: <4B5953D6.7020303@viscovery.net> (raw)
In-Reply-To: <718290.769818367-sendEmail@darysmbp>

David Rydh schrieb:
> diff --git a/builtin-mv.c b/builtin-mv.c
> index 8247186..1c1f8be 100644
> --- a/builtin-mv.c
> +++ b/builtin-mv.c
> @@ -27,7 +27,7 @@ static const char **copy_pathspec(const char *prefix, const char **pathspec,
>  		if (length > 0 && is_dir_sep(result[i][length - 1]))
>  			result[i] = xmemdupz(result[i], length - 1);
>  		if (base_name)
> -			result[i] = basename((char *)result[i]);
> +			result[i] = xstrdup(basename((char *)result[i]));
>  	}
>  	return get_pathspec(prefix, result);
>  }

We are already leaking memory of magnitude O(argc*length of file names),
and IMO, this new leak of the same magnitude doesn't hurt.

If you want to avoid it, you can set NO_LIBGEN_H in Makefile.

The other changes in this patch should really be a separate patch. They do
not fix an immediate problem, right?

-- Hannes

      parent reply	other threads:[~2010-01-22  7:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-21 20:39 [PATCH] git-mv: Fix error with multiple sources David Rydh
2010-01-22  5:57 ` Junio C Hamano
2010-01-22 16:41   ` David Rydh
2010-01-22  6:17 ` Junio C Hamano
2010-01-22 16:49   ` David Rydh
2010-01-22  6:24 ` Junio C Hamano
     [not found]   ` <7vr5pi8x6z.fsf@alter.siamese.dyndns.org>
2010-01-22 17:30     ` David Rydh
2010-01-22 18:34     ` Johannes Sixt
2010-01-22  7:03 ` Matthieu Moy
2010-01-22  7:29 ` Johannes Sixt [this message]

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=4B5953D6.7020303@viscovery.net \
    --to=j.sixt@viscovery.net \
    --cc=dary@math.berkeley.edu \
    --cc=git@vger.kernel.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).