From: Antony Dovgal Date: Tue, 30 May 2006 09:46:59 +0000 (+0000) Subject: no need to call zend_is_callable() if callable is known to be invalid X-Git-Tag: php-5.2.0RC1~428 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e4a3732c913a838a1541dfa645cc7699506162ac;p=php no need to call zend_is_callable() if callable is known to be invalid free fname on failure and plug possible leak --- diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c index 6030fa3b95..de507daf82 100755 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@ -703,8 +703,8 @@ static int do_fetch_class_prepare(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */ 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 @@ static int make_callable_ex(pdo_stmt_t *stmt, zval *callable, zend_fcall_info * 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; }