Re: [PATCH 2/1] config: let `config_store_data_clear()` handle `value_regex`
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- May 14, 2018, 03:05 UTC
- Message-ID
- <CAPig+cQaJmsJe=E6HdBw0s6eN-qW0OCezBacRcQ+UnJYMbODsw@mail.gmail.com>
- In-Reply-To
- <3f64a4e24a83a9041c79c8b302207af7687dbb21.1526204440.git.martin.agren@gmail.com>
On Sun, May 13, 2018 at 5:58 AM, Martin Ågren <martin.agren@gmail.com> wrote:
Show 8 quoted lines
> Instead of carefully clearing up `value_regex` in each code path, let > `config_store_data_clear()` handle that. > > Signed-off-by: Martin Ågren <martin.agren@gmail.com> > --- > I *think* that it should be ok to `regfree()` after `regcomp()` failed, > but I'll need to look into that some more (and say something about it in > the commit message).
My research (for instance [1,2]) seems to indicate that it would be better to avoid regfree() upon failed regcomp(), even though such a situation is handled sanely in some implementations.
[1]: https://www.redhat.com/archives/libvir-list/2013-September/msg00276.html [2]: https://www.redhat.com/archives/libvir-list/2013-September/msg00273.html