From e4a3732c913a838a1541dfa645cc7699506162ac Mon Sep 17 00:00:00 2001 From: Antony Dovgal Date: Tue, 30 May 2006 09:46:59 +0000 Subject: [PATCH] no need to call zend_is_callable() if callable is known to be invalid free fname on failure and plug possible leak --- ext/pdo/pdo_stmt.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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; } -- 2.50.1