From ec01c407ff9691ccdc641c2e322e1c88cfa8a644 Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Fri, 16 Oct 2015 09:28:54 +0200 Subject: [PATCH] libc/regex: Fix a reference of an uninitialized variable. If tre_bt_mem_alloc() fails, xfree() would have been called on an uninitialized 'buf' variable. --- contrib/tre/lib/tre-match-backtrack.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/contrib/tre/lib/tre-match-backtrack.c b/contrib/tre/lib/tre-match-backtrack.c index 726c4c01fb..24ed48cfda 100644 --- a/contrib/tre/lib/tre-match-backtrack.c +++ b/contrib/tre/lib/tre-match-backtrack.c @@ -257,6 +257,9 @@ tre_tnfa_run_backtrack(const tre_tnfa_t *tnfa, const void *string, #ifdef TRE_MBSTATE memset(&mbstate, '\0', sizeof(mbstate)); #endif /* TRE_MBSTATE */ +#ifndef TRE_USE_ALLOCA + buf = NULL; +#endif if (!mem) return REG_ESPACE; -- 2.41.0