Commit 19d2da28 authored by A. Jesse Jiryu Davis's avatar A. Jesse Jiryu Davis
Browse files

CDRIVER-695 crash destroying node after auth err

Avoid scenarios like:

1. Connect to 2-node replica set.

2. _cluster_reconnect_replica_set enters first loop, calls ismaster on primary
   and finds two peers.

3. nodes_len is set to 2 and the nodes list is realloc'ed, but the second node
   is uninitialized.

4. _mongoc_cluster_reconnect_replica_set enters second loop.

5. Auth fails, "goto CLEANUP".

6. Now nodes_len is 2 but the second node is still uninitialized.

7. Later, _mongoc_cluster_node_destroy iterates over both nodes.

8. Destroying second, uninitialized node calls stream->close, which is a random
   location, segfaults.
parent 3f43d637
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment