mirror of
https://github.com/php/php-src.git
synced 2024-11-30 21:35:36 +08:00
Handle OOM in block_alloc_get_chunk, and also in the caller
in mysqlnd_wireprotocol.c
This commit is contained in:
parent
ec0fe858c6
commit
c32bae720c
@ -119,7 +119,7 @@ MYSQLND_MEMORY_POOL_CHUNK * mysqlnd_mempool_get_chunk(MYSQLND_MEMORY_POOL * pool
|
||||
DBG_ENTER("mysqlnd_mempool_get_chunk");
|
||||
|
||||
chunk = mnd_malloc(sizeof(MYSQLND_MEMORY_POOL_CHUNK));
|
||||
|
||||
if (chunk) {
|
||||
chunk->free_chunk = mysqlnd_mempool_free_chunk;
|
||||
chunk->resize_chunk = mysqlnd_mempool_resize_chunk;
|
||||
chunk->size = size;
|
||||
@ -143,6 +143,7 @@ MYSQLND_MEMORY_POOL_CHUNK * mysqlnd_mempool_get_chunk(MYSQLND_MEMORY_POOL * pool
|
||||
/* Last step, update free_size */
|
||||
pool->free_size -= size;
|
||||
}
|
||||
}
|
||||
DBG_RETURN(chunk);
|
||||
}
|
||||
/* }}} */
|
||||
|
@ -1136,6 +1136,10 @@ php_mysqlnd_read_row_ex(MYSQLND * conn, MYSQLND_MEMORY_POOL * result_set_memory_
|
||||
to be able to implement read-only variables. Thus, we add + 1.
|
||||
*/
|
||||
*buffer = result_set_memory_pool->get_chunk(result_set_memory_pool, *data_size + 1 TSRMLS_CC);
|
||||
if (!*buffer) {
|
||||
ret = FAIL;
|
||||
break;
|
||||
}
|
||||
p = (*buffer)->ptr;
|
||||
} else if (!first_iteration) {
|
||||
/* Empty packet after MYSQLND_MAX_PACKET_SIZE packet. That's ok, break */
|
||||
|
Loading…
Reference in New Issue
Block a user