Skip to content

Commit 3da5221

Browse files
committed
Merge branch 'PHP-7.4'
2 parents 787ecb6 + 197b037 commit 3da5221

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

ext/mysqlnd/mysqlnd_result.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -781,6 +781,7 @@ MYSQLND_METHOD(mysqlnd_result_unbuffered, fetch_row)(MYSQLND_RES * result, void
781781
MYSQLND_PACKET_ROW *row_packet = result->unbuf->row_packet;
782782
const MYSQLND_RES_METADATA * const meta = result->meta;
783783
MYSQLND_CONN_DATA * const conn = result->conn;
784+
void *checkpoint;
784785

785786
DBG_ENTER("mysqlnd_result_unbuffered::fetch_row");
786787

@@ -800,6 +801,9 @@ MYSQLND_METHOD(mysqlnd_result_unbuffered, fetch_row)(MYSQLND_RES * result, void
800801
/* Let the row packet fill our buffer and skip additional mnd_malloc + memcpy */
801802
row_packet->skip_extraction = row? FALSE:TRUE;
802803

804+
checkpoint = result->memory_pool->checkpoint;
805+
mysqlnd_mempool_save_state(result->memory_pool);
806+
803807
/*
804808
If we skip rows (row == NULL) we have to
805809
result->m.unbuffered_free_last_data() before it. The function returns always true.
@@ -824,6 +828,8 @@ MYSQLND_METHOD(mysqlnd_result_unbuffered, fetch_row)(MYSQLND_RES * result, void
824828
conn->options->int_and_float_native,
825829
conn->stats);
826830
if (PASS != rc) {
831+
mysqlnd_mempool_restore_state(result->memory_pool);
832+
result->memory_pool->checkpoint = checkpoint;
827833
DBG_RETURN(FAIL);
828834
}
829835
{
@@ -894,6 +900,9 @@ MYSQLND_METHOD(mysqlnd_result_unbuffered, fetch_row)(MYSQLND_RES * result, void
894900
result->unbuf->m.free_last_data(result->unbuf, conn->stats);
895901
}
896902

903+
mysqlnd_mempool_restore_state(result->memory_pool);
904+
result->memory_pool->checkpoint = checkpoint;
905+
897906
DBG_INF_FMT("ret=%s fetched=%u", ret == PASS? "PASS":"FAIL", *fetched_anything);
898907
DBG_RETURN(PASS);
899908
}

0 commit comments

Comments
 (0)