Re: [PATCHv8 3/9] submodule-config: remove name_and_item_from_var
- From
Stefan Beller <sbeller@google.com>
- Date
- Feb 6, 2016, 01:21 UTC
- Message-ID
- <CAGZ79kaY7+vfTdtjT_Mty+pu75wX7dktaWoULoUOnzZC5QGDzw@mail.gmail.com>
- In-Reply-To
- <20160206004615.GB28749@google.com>
On Fri, Feb 5, 2016 at 4:46 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 24 quoted lines
> Hi,
>
> Stefan Beller wrote:
>
>> --- a/submodule-config.c
>> +++ b/submodule-config.c
>> @@ -251,18 +235,19 @@ static int parse_config(const char *var, const char *value, void *data)
>> {
>> struct parse_config_parameter *me = data;
>> struct submodule *submodule;
>> - struct strbuf name = STRBUF_INIT, item = STRBUF_INIT;
>> - int ret = 0;
>> + int subsection_len, ret = 0;
>> + const char *subsection, *key;
>>
>> - /* this also ensures that we only parse submodule entries */
>> - if (!name_and_item_from_var(var, &name, &item))
>> + if (parse_config_key(var, "submodule", &subsection,
>> + &subsection_len, &key) < 0 || !subsection)
>> return 0;
>>
>> + subsection = xmemdupz(subsection, subsection_len);
>
> This appears to be leaked.Good point, will fix.
Though the impact is negligible, as this code goes away the next patch and there is a free included.
Thanks, Stefan
> > Thanks, > Jonathan