Re: [PATCH 4/7] revert: free opts.revs to do a bit of cleanup
- From
Ramkumar Ramachandra <artagnon@gmail.com>
- Date
- May 22, 2012, 05:14 UTC
- Message-ID
- <CALkWK0=1a_LvQ=zhdAEt91j1sMsgp6J=_CyeNFOkB95dw15pnQ@mail.gmail.com>
- In-Reply-To
- <20120521145610.1911.57879.chriscool@tuxfamily.org>
Hi Christian,
Christian Couder wrote:
Show 20 quoted lines
> diff --git a/builtin/revert.c b/builtin/revert.c
> index 82d1bf8..5f82a84 100644
> --- a/builtin/revert.c
> +++ b/builtin/revert.c
> @@ -217,6 +217,7 @@ int cmd_revert(int argc, const char **argv, const char *prefix)
> git_config(git_default_config, NULL);
> parse_args(argc, argv, &opts);
> res = sequencer_pick_revisions(&opts);
> + free(opts.revs);
> if (res < 0)
> die(_("revert failed"));
> return res;
> @@ -232,6 +233,7 @@ int cmd_cherry_pick(int argc, const char **argv, const char *prefix)
> git_config(git_default_config, NULL);
> parse_args(argc, argv, &opts);
> res = sequencer_pick_revisions(&opts);
> + free(opts.revs);
> if (res < 0)
> die(_("cherry-pick failed"));
> return res;Technically, memory is allocated to both opts->revs and opts->xopts in parse_args(). Why not free both?
Ram