Skip to content

Commit cf50d63

Browse files
committed
CDRIVER-3336 Uninitialised BSON reply on error
1 parent 1102eb9 commit cf50d63

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/libmongoc/src/mongoc/mongoc-cluster.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1896,6 +1896,7 @@ mongoc_cluster_stream_for_server (mongoc_cluster_t *cluster,
18961896
BSON_ASSERT (server_id);
18971897

18981898
if (cs && cs->server_id && cs->server_id != server_id) {
1899+
_mongoc_bson_init_if_set (reply);
18991900
bson_set_error (error,
19001901
MONGOC_ERROR_COMMAND,
19011902
MONGOC_ERROR_SERVER_SELECTION_INVALID_ID,

src/libmongoc/tests/test-mongoc-transactions.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -957,6 +957,7 @@ test_selected_server_is_pinned_to_mongos (void *ctx)
957957
ASSERT_OR_PRINT (r, error);
958958

959959
bson_destroy (insert_opts);
960+
bson_destroy (&reply);
960961
mongoc_collection_destroy (coll);
961962
mongoc_database_destroy (db);
962963
mongoc_session_opts_destroy (session_opts);

0 commit comments

Comments
 (0)