com php-src: Fixed bug #77599 (Unbuffered queries; native prepared statements memory leak): NEWS ext/mysqlnd/mysqlnd_ps.c

From: Date: Tue, 12 Feb 2019 07:55:05 +0000
Subject: com php-src: Fixed bug #77599 (Unbuffered queries; native prepared statements memory leak): NEWS ext/mysqlnd/mysqlnd_ps.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-104567@lists.php.net to get a copy of this message
Commit: b6e58dcd2262c30c0657624ca3c372dc90d5a031 Author: Dmitry Stogov <dmitry@zend.com> Tue, 12 Feb 2019 10:55:05 +0300 Parents: 470f5891d48cad64fd73dbb34775b3bcce1337cf Branches: PHP-7.3 PHP-7.4 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=b6e58dcd2262c30c0657624ca3c372dc90d5a031 Log: Fixed bug #77599 (Unbuffered queries; native prepared statements memory leak) Bugs: https://bugs.php.net/77599 Changed paths: M NEWS M ext/mysqlnd/mysqlnd_ps.c Diff: diff --git a/NEWS b/NEWS index 8f3e10e..a1fb54f 100644 --- a/NEWS +++ b/NEWS @@ -18,6 +18,10 @@ PHP NEWS . Fixed bug #77514 (mb_ereg_replace() with trailing backslash adds null byte). (Nikita) +- MySQLnd: + . Fixed bug #77599 (Unbuffered queries; native prepared statements memory + leak). (Dmitry) + - OpenSSL: . Fixed bug #77390 (feof might hang on TLS streams in case of fragmented TLS records). (Abyl Valg, Jakub Zelenka) diff --git a/ext/mysqlnd/mysqlnd_ps.c b/ext/mysqlnd/mysqlnd_ps.c index f3fab43..b2017b9 100644 --- a/ext/mysqlnd/mysqlnd_ps.c +++ b/ext/mysqlnd/mysqlnd_ps.c @@ -851,6 +851,7 @@ mysqlnd_stmt_fetch_row_unbuffered(MYSQLND_RES * result, void * param, const unsi MYSQLND_PACKET_ROW * row_packet; MYSQLND_CONN_DATA * conn = result->conn; const MYSQLND_RES_METADATA * const meta = result->meta; + void *checkpoint; DBG_ENTER("mysqlnd_stmt_fetch_row_unbuffered"); @@ -873,6 +874,9 @@ mysqlnd_stmt_fetch_row_unbuffered(MYSQLND_RES * result, void * param, const unsi /* Let the row packet fill our buffer and skip additional malloc + memcpy */ row_packet->skip_extraction = stmt && stmt->result_bind? FALSE:TRUE; + checkpoint = result->memory_pool->checkpoint; + mysqlnd_mempool_save_state(result->memory_pool); + /* If we skip rows (stmt == NULL || stmt->result_bind == NULL) we have to result->unbuf->m.free_last_data() before it. The function returns always true. @@ -895,6 +899,8 @@ mysqlnd_stmt_fetch_row_unbuffered(MYSQLND_RES * result, void * param, const unsi conn->options->int_and_float_native, conn->stats)) { + mysqlnd_mempool_restore_state(result->memory_pool); + result->memory_pool->checkpoint = checkpoint; DBG_RETURN(FAIL); } @@ -965,6 +971,9 @@ mysqlnd_stmt_fetch_row_unbuffered(MYSQLND_RES * result, void * param, const unsi } } + mysqlnd_mempool_restore_state(result->memory_pool); + result->memory_pool->checkpoint = checkpoint; + DBG_INF_FMT("ret=%s fetched_anything=%u", ret == PASS? "PASS":"FAIL", *fetched_anything); DBG_RETURN(ret); }

« previous php.cvs (#104567) next »