{"thread":{"id":"5569","subject":"duplicate memory allocation in buildin-add.c","startedAt":"2006-09-15T11:26:55Z","lastAt":"2006-09-15T11:26:55Z","messageCount":1,"participants":["Liu Yubao"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"26961","messageId":"450A8DFF.9040605@gmail.com","threadId":"5569","inReplyTo":null,"subject":"duplicate memory allocation in buildin-add.c","fromName":"Liu Yubao","fromEmail":"yubao.liu@gmail.com","sentAt":"2006-09-15T11:26:55Z","receivedAt":"2006-09-15T11:26:55Z","isPatch":false,"sender":{"key":"yubao.liu@gmail.com","avatar":null},"body":"http://www.kernel.org/git/?p=git/git.git;a=commitdiff;h=0d78153952e70c21e94dc6b7eefcb2ac5337a902\n\nbuildin-add.c:\n\n+static void fill_directory(struct dir_struct *dir, const char **pathspec)\n+{\n+ \tconst char *path, *base;\n+ \tint baselen;\n...\n+ \tif (baselen) {\n+ \t\tchar *common = xmalloc(baselen + 1);\n+ \t\tcommon = xmalloc(baselen + 1);\n+ \t\tmemcpy(common, *pathspec, baselen);\n+ \t\tcommon[baselen] = 0;\n+ \t\tpath = base = common;\n+ \t}\n...\n\nAllocate memory twice for \"common\" variable, is it indended? I'm very confused @_@\n"}]}