Re: [PATCH 3/4] describe: use argv-array

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

 



On Sun, Jul 07, 2013 at 03:33:43PM -0700, Junio C Hamano wrote:

> +		argv_array_init(&args);
> +		argv_array_push(&args, "name-rev");
> +		argv_array_push(&args, "--name-only");
> +		argv_array_push(&args, "--no-undefined");
> [...]
> -		memcpy(args + i, argv, argc * sizeof(char *));
> -		args[i + argc] = NULL;
> -		return cmd_name_rev(i + argc, args, prefix);
> +		return cmd_name_rev(args.argc, args.argv, prefix);

This leaks the memory allocated by "args". The original did, too, and it
is probably not that big a deal (we exit right after anyway). The fix
would be something like:

  rc = cmd_name_rev(args.argc, args.argv, prefix);
  argv_array_clear(&args);
  return rc;

-Peff
--
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]