summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorAndrey Hristov <andrey@php.net>2010-05-27 12:44:10 (GMT)
committerAndrey Hristov <andrey@php.net>2010-05-27 12:44:10 (GMT)
commit1228c923039d10b2c86d55022fb379f7f6edbd70 (patch)
treeb3b2230763e33bc9f1d2329b3e3900ca829a4089 /ext
parent3251e54f0f56775f50078b75bdc3da11ade3caab (diff)
downloadphp-1228c923039d10b2c86d55022fb379f7f6edbd70.tar.gz
Check before use, because mysqlnd can return NULL
and this will crash. However, this can happen only in case of OOM.
Diffstat (limited to 'ext')
-rw-r--r--ext/mysqli/mysqli_api.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c
index 6615b70..6150f71 100644
--- a/ext/mysqli/mysqli_api.c
+++ b/ext/mysqli/mysqli_api.c
@@ -453,10 +453,13 @@ mysqli_stmt_bind_result_do_bind(MY_STMT *stmt, zval ***args, unsigned int argc,
{
unsigned int i;
MYSQLND_RESULT_BIND * params = mysqlnd_stmt_alloc_result_bind(stmt->stmt);
- for (i = 0; i < (argc - start); i++) {
- params[i].zv = *(args[i + start]);
+ if (params) {
+ for (i = 0; i < (argc - start); i++) {
+ params[i].zv = *(args[i + start]);
+ }
+ return mysqlnd_stmt_bind_result(stmt->stmt, params);
}
- return mysqlnd_stmt_bind_result(stmt->stmt, params);
+ return FAIL;
}
#endif
/* }}} */