tony2001 Tue May 30 09:46:59 2006 UTC
Modified files: (Branch: PHP_5_2)
/php-src/ext/pdo pdo_stmt.c
Log:
no need to call zend_is_callable() if callable is known to be invalid
free fname on failure and plug possible leak
http://cvs.php.net/viewcvs.cgi/php-src/ext/pdo/pdo_stmt.c?r1=1.118.2.38.2.1&r2=1.118.2.38.2.2&diff_format=u
Index: php-src/ext/pdo/pdo_stmt.c
diff -u php-src/ext/pdo/pdo_stmt.c:1.118.2.38.2.1
php-src/ext/pdo/pdo_stmt.c:1.118.2.38.2.2
--- php-src/ext/pdo/pdo_stmt.c:1.118.2.38.2.1 Thu May 11 22:43:44 2006
+++ php-src/ext/pdo/pdo_stmt.c Tue May 30 09:46:59 2006
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pdo_stmt.c,v 1.118.2.38.2.1 2006/05/11 22:43:44 helly Exp $ */
+/* $Id: pdo_stmt.c,v 1.118.2.38.2.2 2006/05/30 09:46:59 tony2001 Exp $ */
/* The PDO Statement Handle Class */
@@ -703,8 +703,8 @@
static int make_callable_ex(pdo_stmt_t *stmt, zval *callable, zend_fcall_info
* fci, zend_fcall_info_cache * fcc, int num_args TSRMLS_DC) /* {{{ */
{
- zval **object = NULL, **method;
- char *fname, *cname;
+ zval **object = NULL, **method = NULL;
+ char *fname = NULL, *cname;
zend_class_entry * ce = NULL, **pce;
zend_function *function_handler;
@@ -739,8 +739,11 @@
method = &callable;
}
- if (!zend_is_callable(callable, 0, &fname)) {
+ if (!method || !zend_is_callable(callable, 0, &fname)) {
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "user-supplied
function must be a valid callback" TSRMLS_CC);
+ if (fname) {
+ efree(fname);
+ }
return 0;
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php