summaryrefslogtreecommitdiff
path: root/ext/mysqlnd/mysqlnd_wireprotocol.c
diff options
context:
space:
mode:
authorAndrey Hristov <andrey@php.net>2010-05-14 13:04:33 +0000
committerAndrey Hristov <andrey@php.net>2010-05-14 13:04:33 +0000
commitce0ea97850f342ce25bd03b9938c489e93ac4247 (patch)
treeeb989890a8e5990ab1a0a9b52dd293b887450075 /ext/mysqlnd/mysqlnd_wireprotocol.c
parenta78fa3fcaf92f2e668262480d0384acb60be1420 (diff)
downloadphp-git-ce0ea97850f342ce25bd03b9938c489e93ac4247.tar.gz
OOM fixes
Diffstat (limited to 'ext/mysqlnd/mysqlnd_wireprotocol.c')
-rw-r--r--ext/mysqlnd/mysqlnd_wireprotocol.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/ext/mysqlnd/mysqlnd_wireprotocol.c b/ext/mysqlnd/mysqlnd_wireprotocol.c
index 39a3c94b04..5b1bca906e 100644
--- a/ext/mysqlnd/mysqlnd_wireprotocol.c
+++ b/ext/mysqlnd/mysqlnd_wireprotocol.c
@@ -1024,6 +1024,10 @@ php_mysqlnd_rset_field_read(void *_packet, MYSQLND *conn TSRMLS_DC)
BAIL_IF_NO_MORE_DATA;
DBG_INF_FMT("Def found, length %lu, persistent=%d", len, packet->persistent_alloc);
meta->def = mnd_pemalloc(len + 1, packet->persistent_alloc);
+ if (!meta->def) {
+ SET_OOM_ERROR(conn->error_info);
+ DBG_RETURN(FAIL);
+ }
memcpy(meta->def, p, len);
meta->def[len] = '\0';
meta->def_length = len;
@@ -1032,6 +1036,11 @@ php_mysqlnd_rset_field_read(void *_packet, MYSQLND *conn TSRMLS_DC)
DBG_INF_FMT("allocing root. persistent=%d", packet->persistent_alloc);
root_ptr = meta->root = mnd_pemalloc(total_len, packet->persistent_alloc);
+ if (!root_ptr) {
+ SET_OOM_ERROR(conn->error_info);
+ DBG_RETURN(FAIL);
+ }
+
meta->root_len = total_len;
/* Now do allocs */
if (meta->catalog && meta->catalog != mysqlnd_empty_string) {
@@ -1100,7 +1109,6 @@ static
void php_mysqlnd_rset_field_free_mem(void *_packet, zend_bool alloca TSRMLS_DC)
{
MYSQLND_PACKET_RES_FIELD *p= (MYSQLND_PACKET_RES_FIELD *) _packet;
-
/* p->metadata was passed to us as temporal buffer */
if (!alloca) {
mnd_pefree(p, p->header.persistent);