diff --git a/ext/mysqlnd/mysqlnd_ps.c b/ext/mysqlnd/mysqlnd_ps.c index 256bbe4d47a..41c024ab16f 100644 --- a/ext/mysqlnd/mysqlnd_ps.c +++ b/ext/mysqlnd/mysqlnd_ps.c @@ -122,7 +122,7 @@ MYSQLND_METHOD(mysqlnd_stmt, store_result)(MYSQLND_STMT * const s) } else { COPY_CLIENT_ERROR(conn->error_info, result->stored_data->error_info); stmt->result->m.free_result_contents(stmt->result); - mnd_efree(stmt->result); + mnd_pefree(stmt->result, stmt->result->persistent); stmt->result = NULL; stmt->state = MYSQLND_STMT_PREPARED; } @@ -347,7 +347,7 @@ mysqlnd_stmt_prepare_read_eof(MYSQLND_STMT * s) if (FAIL == (ret = PACKET_READ(fields_eof))) { if (stmt->result) { stmt->result->m.free_result_contents(stmt->result); - mnd_efree(stmt->result); + mnd_pefree(stmt->result, stmt->result->persistent); /* XXX: This will crash, because we will null also the methods. But seems it happens in extreme cases or doesn't. Should be fixed by exporting a function (from mysqlnd_driver.c?) to do the reset. diff --git a/ext/opcache/Optimizer/zend_cfg.c b/ext/opcache/Optimizer/zend_cfg.c index 06cf266b9d8..0f0cabb2587 100644 --- a/ext/opcache/Optimizer/zend_cfg.c +++ b/ext/opcache/Optimizer/zend_cfg.c @@ -755,7 +755,7 @@ static void swap_blocks(block_info *a, block_info *b) { int zend_cfg_identify_loops(const zend_op_array *op_array, zend_cfg *cfg, uint32_t *flags) /* {{{ */ { int i, j, k, n; - int depth, time; + int time; zend_basic_block *blocks = cfg->blocks; int *entry_times, *exit_times; zend_worklist work; diff --git a/ext/pdo_mysql/tests/bug_74376.phpt b/ext/pdo_mysql/tests/bug_74376.phpt new file mode 100644 index 00000000000..29b16748ffb --- /dev/null +++ b/ext/pdo_mysql/tests/bug_74376.phpt @@ -0,0 +1,27 @@ +--TEST-- +Bug #74376 (Invalid free of persistent results on error/connection loss) +--SKIPIF-- + +--FILE-- +query("select (select 1 union select 2)"); + +print "ok"; +?> +--EXPECTF-- +ok