]> granicus.if.org Git - php/commitdiff
return NULL in case of error (and fix leak/non-null-terminated string error)
authorAntony Dovgal <tony2001@php.net>
Mon, 29 May 2006 20:26:12 +0000 (20:26 +0000)
committerAntony Dovgal <tony2001@php.net>
Mon, 29 May 2006 20:26:12 +0000 (20:26 +0000)
ext/pcre/php_pcre.c

index 0504da6362d6c3c0bf4d7124c10e48fb665e92c1..84cfc0ac9157f6075772c38a7669189a7a4d25ec 100644 (file)
@@ -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;
                }