* duplicate memory allocation in buildin-add.c
@ 2006-09-15 11:26 Liu Yubao
0 siblings, 0 replies; only message in thread
From: Liu Yubao @ 2006-09-15 11:26 UTC (permalink / raw)
To: git
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 @_@
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2006-09-15 11:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-15 11:26 duplicate memory allocation in buildin-add.c Liu Yubao
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).