@@ -1062,6 +1062,11 @@ _mongoc_cluster_auth_node_cr (mongoc_cluster_t *cluster,
1062
1062
parts .prohibit_lsid = true;
1063
1063
server_stream = _mongoc_cluster_create_server_stream (
1064
1064
cluster -> client -> topology , sd -> id , stream , error );
1065
+ if (!server_stream ) {
1066
+ bson_destroy (& command );
1067
+ bson_destroy (& reply );
1068
+ RETURN (false);
1069
+ }
1065
1070
1066
1071
if (!mongoc_cluster_run_command_parts (
1067
1072
cluster , server_stream , & parts , & reply , error )) {
@@ -1191,6 +1196,12 @@ _mongoc_cluster_auth_node_plain (mongoc_cluster_t *cluster,
1191
1196
parts .prohibit_lsid = true;
1192
1197
server_stream = _mongoc_cluster_create_server_stream (
1193
1198
cluster -> client -> topology , sd -> id , stream , error );
1199
+ if (!server_stream ) {
1200
+ bson_destroy (& b );
1201
+ bson_destroy (& reply );
1202
+ return false;
1203
+ }
1204
+
1194
1205
ret = mongoc_cluster_run_command_parts (
1195
1206
cluster , server_stream , & parts , & reply , error );
1196
1207
mongoc_server_stream_cleanup (server_stream );
@@ -1299,6 +1310,12 @@ _mongoc_cluster_auth_node_x509 (mongoc_cluster_t *cluster,
1299
1310
parts .prohibit_lsid = true;
1300
1311
server_stream = _mongoc_cluster_create_server_stream (
1301
1312
cluster -> client -> topology , sd -> id , stream , error );
1313
+ if (!server_stream ) {
1314
+ bson_destroy (& cmd );
1315
+ bson_destroy (& reply );
1316
+ return false;
1317
+ }
1318
+
1302
1319
ret = mongoc_cluster_run_command_parts (
1303
1320
cluster , server_stream , & parts , & reply , error );
1304
1321
mongoc_server_stream_cleanup (server_stream );
@@ -1429,7 +1446,11 @@ _mongoc_cluster_run_scram_command (mongoc_cluster_t *cluster,
1429
1446
parts .prohibit_lsid = true;
1430
1447
server_stream = _mongoc_cluster_create_server_stream (
1431
1448
cluster -> client -> topology , server_id , stream , error );
1432
- BSON_ASSERT (server_stream );
1449
+ if (!server_stream ) {
1450
+ bson_destroy (reply );
1451
+ return false;
1452
+ }
1453
+
1433
1454
if (!mongoc_cluster_run_command_parts (
1434
1455
cluster , server_stream , & parts , reply , error )) {
1435
1456
mongoc_server_stream_cleanup (server_stream );
@@ -3021,6 +3042,10 @@ mongoc_cluster_check_interval (mongoc_cluster_t *cluster, uint32_t server_id)
3021
3042
parts .prohibit_lsid = true;
3022
3043
server_stream = _mongoc_cluster_create_server_stream (
3023
3044
cluster -> client -> topology , server_id , stream , & error );
3045
+ if (!server_stream ) {
3046
+ bson_destroy (& command );
3047
+ return false;
3048
+ }
3024
3049
r = mongoc_cluster_run_command_parts (
3025
3050
cluster , server_stream , & parts , NULL , & error );
3026
3051
0 commit comments