Re: [PATCH 5/8] revert: allow cherry-picking more than one commit

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

 



Christian Couder wrote:

> --- a/builtin/revert.c
> +++ b/builtin/revert.c
> @@ -520,8 +516,33 @@ static int do_pick_commit()
>  	return 0;
>  }
>  
> +static void prepare_revs(struct rev_info *revs)
> +{
> +	int argc = 0;
> +	int i;
> +	const char **argv = xmalloc((commit_argc + 4) * sizeof(*argv));
> +
> +	argv[argc++] = NULL;
> +	argv[argc++] = "--no-walk";
> +	if (action != REVERT)
> +		argv[argc++] = "--reverse";
> +	for (i = 0; i < commit_argc; i++)
> +		argv[argc++] = commit_argv[i];
> +	argv[argc++] = NULL;
> +
> +	init_revisions(revs, NULL);
> +	setup_revisions(argc - 1, argv, revs, NULL);
> +	if (prepare_revision_walk(revs))
> +		die("revision walk setup failed");
> +
> +	if (!revs->commits)
> +		die("empty commit set passed");
> +}

Tiny one-time leak.  Maybe avoiding it will make debugging tools
happier.

The rest of the patch of course looks good.  Thanks.

diff --git a/builtin/revert.c b/builtin/revert.c
index b90955f..a73f66b 100644
--- a/builtin/revert.c
+++ b/builtin/revert.c
@@ -532,6 +532,7 @@ static void prepare_revs(struct rev_info *revs)
 
 	init_revisions(revs, NULL);
 	setup_revisions(argc - 1, argv, revs, NULL);
+	free(argv);
 	if (prepare_revision_walk(revs))
 		die("revision walk setup failed");
 
--
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]