cvs: php4 /ext/pcre php_pcre.c
| From: | Andrei Zmievski | Date: | Sun, 20 May 2001 01:21:44 +0000 |
| Subject: | cvs: php4 /ext/pcre php_pcre.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-5863@lists.php.net to get a copy of this message | ||
andrei Sat May 19 18:21:44 2001 EDT
Modified files:
/php4/ext/pcre php_pcre.c
Log:
Properly free callback_name only when necessary.
Index: php4/ext/pcre/php_pcre.c
diff -u php4/ext/pcre/php_pcre.c:1.96 php4/ext/pcre/php_pcre.c:1.97
--- php4/ext/pcre/php_pcre.c:1.96 Tue May 15 11:00:35 2001
+++ php4/ext/pcre/php_pcre.c Sat May 19 18:21:44 2001
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_pcre.c,v 1.96 2001/05/15 18:00:35 andrei Exp $ */
+/* $Id: php_pcre.c,v 1.97 2001/05/20 01:21:44 andrei Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -981,16 +981,17 @@
SEPARATE_ZVAL(replace);
if (Z_TYPE_PP(replace) != IS_ARRAY)
convert_to_string_ex(replace);
- if (is_callable_replace && !zend_is_callable(*replace, 0, &callback_name)) {
- php_error(E_WARNING, "%s() requires argument 2, '%s', to be a valid
callback",
- get_active_function_name(), callback_name);
+ if (is_callable_replace) {
+ if (!zend_is_callable(*replace, 0, &callback_name)) {
+ php_error(E_WARNING, "%s() requires argument 2, '%s', to be a valid
callback",
+ get_active_function_name(), callback_name);
+ efree(callback_name);
+ *return_value = **subject;
+ zval_copy_ctor(return_value);
+ return;
+ }
efree(callback_name);
- *return_value = **subject;
- zval_copy_ctor(return_value);
- return;
}
- if (callback_name)
- efree(callback_name);
SEPARATE_ZVAL(regex);
SEPARATE_ZVAL(subject);