@@ -625,12 +625,12 @@ static mongoc_server_description_t *
625
625
_mongoc_stream_run_ismaster (mongoc_cluster_t * cluster ,
626
626
mongoc_stream_t * stream ,
627
627
const char * address ,
628
- uint32_t server_id )
628
+ uint32_t server_id ,
629
+ bson_error_t * error )
629
630
{
630
631
const bson_t * command ;
631
632
mongoc_cmd_parts_t parts ;
632
633
bson_t reply ;
633
- bson_error_t error ;
634
634
int64_t start ;
635
635
int64_t rtt_msec ;
636
636
mongoc_server_description_t * sd ;
@@ -647,7 +647,7 @@ _mongoc_stream_run_ismaster (mongoc_cluster_t *cluster,
647
647
648
648
start = bson_get_monotonic_time ();
649
649
server_stream = _mongoc_cluster_create_server_stream (
650
- cluster -> client -> topology , server_id , stream , & error );
650
+ cluster -> client -> topology , server_id , stream , error );
651
651
if (!server_stream ) {
652
652
RETURN (NULL );
653
653
}
@@ -656,7 +656,8 @@ _mongoc_stream_run_ismaster (mongoc_cluster_t *cluster,
656
656
& parts , cluster -> client , "admin" , MONGOC_QUERY_SLAVE_OK , command );
657
657
parts .prohibit_lsid = true;
658
658
if (!mongoc_cluster_run_command_parts (
659
- cluster , server_stream , & parts , & reply , & error )) {
659
+ cluster , server_stream , & parts , & reply , error )) {
660
+ bson_destroy (& reply );
660
661
mongoc_server_stream_cleanup (server_stream );
661
662
RETURN (NULL );
662
663
}
@@ -668,7 +669,7 @@ _mongoc_stream_run_ismaster (mongoc_cluster_t *cluster,
668
669
669
670
mongoc_server_description_init (sd , address , server_id );
670
671
/* send the error from run_command IN to handle_ismaster */
671
- mongoc_server_description_handle_ismaster (sd , & reply , rtt_msec , & error );
672
+ mongoc_server_description_handle_ismaster (sd , & reply , rtt_msec , error );
672
673
673
674
bson_destroy (& reply );
674
675
@@ -719,7 +720,7 @@ _mongoc_cluster_run_ismaster (mongoc_cluster_t *cluster,
719
720
BSON_ASSERT (node -> stream );
720
721
721
722
sd = _mongoc_stream_run_ismaster (
722
- cluster , node -> stream , node -> connection_address , server_id );
723
+ cluster , node -> stream , node -> connection_address , server_id , error );
723
724
724
725
if (!sd ) {
725
726
return NULL ;
@@ -1742,7 +1743,7 @@ mongoc_cluster_fetch_stream_single (mongoc_cluster_t *cluster,
1742
1743
#endif
1743
1744
1744
1745
sd = _mongoc_stream_run_ismaster (
1745
- cluster , stream , scanner_node -> host .host_and_port , server_id );
1746
+ cluster , stream , scanner_node -> host .host_and_port , server_id , error );
1746
1747
1747
1748
if (!sd ) {
1748
1749
return NULL ;
0 commit comments