mongodb/mongo-c-driver — pull request #158 by jsbattig (2013-10-03 16:49:30+00:00)
Title: Removed call to mongo_cursor_destroy() when call to mongo_message_send() fails

Removed call to mongo_cursor_destroy() when call to mongo_message_send() fails fails with value != than MONGO_OK with the purpose of delegating responsability of destroying the cursor to the consumer of the cursor.

See the next lines:
res = mongo_read_response( cursor->conn, &( cursor->reply ) );
if( res != MONGO_OK )
return MONGO_ERROR;

Semantically the developer will probably program his/her code to destroy the cursor upon receiving a MONGO_ERROR return value. But how the code was before, it will receive a MONGO_ERROR without having a clear way of knowing that the cursor was destroyed.
I think we need this change to keep consistent semantics on object lifecycle management. Let the user create/destroy the cursor