Skip to content

Commit 4039c28

Browse files
jmikolabjori
authored andcommitted
CDRIVER-1046: Free BSON reader before new assignment
1 parent fed413d commit 4039c28

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/mongoc/mongoc-cursor.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ _mongoc_cursor_op_query (mongoc_cursor_t *cursor,
468468
}
469469

470470
if (cursor->reader) {
471-
bson_reader_destroy(cursor->reader);
471+
bson_reader_destroy (cursor->reader);
472472
}
473473

474474
cursor->reader = bson_reader_new_from_data(
@@ -554,6 +554,10 @@ _mongoc_cursor_run_command (mongoc_cursor_t *cursor,
554554
GOTO (done);
555555
}
556556

557+
if (cursor->reader) {
558+
bson_reader_destroy (cursor->reader);
559+
}
560+
557561
cursor->reader = bson_reader_new_from_data (
558562
cursor->rpc.reply.documents,
559563
(size_t)cursor->rpc.reply.documents_len);

0 commit comments

Comments
 (0)