duplicate memory allocation in buildin-add.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 @_@
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]