Skip to content

Commit 5189cfe

Browse files
committed
Call rb_mysql_result_free_result immediately when numberOfRows == 0
1 parent 270ebf3 commit 5189cfe

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

ext/mysql2/result.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -911,6 +911,7 @@ static VALUE rb_mysql_result_each(int argc, VALUE * argv, VALUE self) {
911911
if (wrapper->lastRowProcessed == 0 && !wrapper->is_streaming) {
912912
wrapper->numberOfRows = wrapper->stmt_wrapper ? mysql_stmt_num_rows(wrapper->stmt_wrapper->stmt) : mysql_num_rows(wrapper->result);
913913
if (wrapper->numberOfRows == 0) {
914+
rb_mysql_result_free_result(wrapper);
914915
wrapper->rows = rb_ary_new();
915916
return wrapper->rows;
916917
}

0 commit comments

Comments
 (0)