Re: [PATCH 4/7] revert: free opts.revs to do a bit of cleanup
- From
Christian Couder <chriscool@tuxfamily.org>
- Date
- May 22, 2012, 20:03 UTC
- Message-ID
- <20120522.220310.2276783773227531713.chriscool@tuxfamily.org>
- In-Reply-To
- <CALkWK0=1a_LvQ=zhdAEt91j1sMsgp6J=_CyeNFOkB95dw15pnQ@mail.gmail.com>
Hi Ram,
From: Ramkumar Ramachandra <artagnon@gmail.com>
Show 26 quoted lines
> Hi Christian,
>
> Christian Couder wrote:
>> 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?I didn't see any leak with opts->xopts but I will have a look.
Thanks, Christian.