From d5462c527ab7e0f536f9ea05a27774bc3b2fddc4 Mon Sep 17 00:00:00 2001 From: Antony Dovgal Date: Mon, 29 May 2006 20:26:12 +0000 Subject: [PATCH] return NULL in case of error (and fix leak/non-null-terminated string error) --- ext/pcre/php_pcre.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 0504da6362..84cfc0ac91 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -1115,6 +1115,10 @@ PHPAPI char *php_pcre_replace(char *regex, int regex_len, } } else { pcre_handle_exec_error(count TSRMLS_CC); + if (result) { + efree(result); + result = NULL; + } break; } -- 2.50.1