Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/libmongoc/src/mongoc/mongoc-cursor.c
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,11 @@ _retryable_cursor_commmand_select_retry_server(void *user_data,

mongoc_cursor_t *const cursor = context->cursor;

/* `reply` still owns the previous attempt's contents, and stream_for_reads
* overwrites it as an out-param on server-selection failure without freeing
* it first. Reset it here so that allocation is not leaked. */
bson_destroy(reply);
bson_init(reply);

*context->server_stream = mongoc_cluster_stream_for_reads(&cursor->client->cluster,
context->ss_log_context,
Expand Down