From: Junio C Hamano Date: Fri, 09 Aug 2019 17:46:55 GMT Subject: Re: [RFC PATCH v5 0/3] grep: almost no more leaks, hopefully no crashes Message-ID: In-Reply-To: René Scharfe writes: > So how about starting stupidly simple? You can test it everywhere, it > just needs libpcre2. It works without that library as well (tested with > "make USE_LIBPCRE= USE_LIBPCRE2= test"), but doesn't allocate anything > in that case, of course. The character tables leak fix should be safe > on top. If you detect performance issues then we can address them in > additional patches. > > -- >8 -- > Subject: [PATCH] grep: use xmalloc() for all PCRE2 allocations > > Build a PCRE2 global custom context when compiling a pattern and use it > to tell the library to use xmalloc() for allocations. This provides > consistent out-of-memory handling and makes sure it uses a custom > allocator, e.g. with USE_NED_ALLOCATOR. > > Signed-off-by: René Scharfe > --- > The function names are ridiculously long, I tried to stay within 80 > characters per line but gave up in the end and just kept going without > line breaks. Fits the "stupidly simple" approach.. ;-) Thanks for keeping the conversation going.