Re: [PATCH] regex: do not call `regfree()` if compilation fails

2018-05-22 Thread Martin Ågren
On 22 May 2018 at 04:20, Eric Sunshine wrote: > On Mon, May 21, 2018 at 2:43 PM, Stefan Beller wrote: >> On Sun, May 20, 2018 at 3:50 AM, Martin Ågren wrote: >>> It is apparently undefined behavior to call `regfree()` on a

Re: [PATCH] regex: do not call `regfree()` if compilation fails

2018-05-21 Thread Eric Sunshine
On Mon, May 21, 2018 at 2:43 PM, Stefan Beller wrote: > On Sun, May 20, 2018 at 3:50 AM, Martin Ågren wrote: >> It is apparently undefined behavior to call `regfree()` on a regex where >> `regcomp()` failed. [...] >> >> diff --git a/diffcore-pickaxe.c

Re: [PATCH] regex: do not call `regfree()` if compilation fails

2018-05-21 Thread Stefan Beller
On Sun, May 20, 2018 at 3:50 AM, Martin Ågren wrote: > It is apparently undefined behavior to call `regfree()` on a regex where > `regcomp()` failed. The language in [1] is a bit muddy, at least to me, > but the clearest hint is this (`preg` is the `regex_t *`): > >

[PATCH] regex: do not call `regfree()` if compilation fails

2018-05-20 Thread Martin Ågren
It is apparently undefined behavior to call `regfree()` on a regex where `regcomp()` failed. The language in [1] is a bit muddy, at least to me, but the clearest hint is this (`preg` is the `regex_t *`): Upon successful completion, the regcomp() function shall return 0. Otherwise, it