All of lore.kernel.org
 help / color / mirror / Atom feed
From: Liu Yubao <yubao.liu@gmail.com>
To: git@vger.kernel.org
Subject: duplicate memory allocation in buildin-add.c
Date: Fri, 15 Sep 2006 19:26:55 +0800	[thread overview]
Message-ID: <450A8DFF.9040605@gmail.com> (raw)

http://www.kernel.org/git/?p=git/git.git;a=commitdiff;h=0d78153952e70c21e94dc6b7eefcb2ac5337a902

buildin-add.c:

+static void fill_directory(struct dir_struct *dir, const char **pathspec)
+{
+ 	const char *path, *base;
+ 	int baselen;
...
+ 	if (baselen) {
+ 		char *common = xmalloc(baselen + 1);
+ 		common = xmalloc(baselen + 1);
+ 		memcpy(common, *pathspec, baselen);
+ 		common[baselen] = 0;
+ 		path = base = common;
+ 	}
...

Allocate memory twice for "common" variable, is it indended? I'm very confused @_@

                 reply	other threads:[~2006-09-15 11:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=450A8DFF.9040605@gmail.com \
    --to=yubao.liu@gmail.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.