Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-209

mongo_cursor_get_more should not call mongo_cursor_destroy

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 0.8.1
    • Affects Version/s: 0.7.1
    • Component/s: None
    • None

      The function mongo_cursor_get_more() should not call mongo_cursor_destroy(),
      because then it's impossible to know whether this should be done in the client,
      since all paths just result in MONGO_ERROR being returned.

      Diff, which includes the incorrect bson_free mentioned in ticket CDRIVER-208:

      diff --git a/src/mongo.c b/src/mongo.c
      index c8df093..3487488 100644
      — a/src/mongo.c
      +++ b/src/mongo.c
      @@ -1269,16 +1269,13 @@ static int mongo_cursor_get_more( mongo_cursor *cursor ) {
      data = mongo_data_append32( data, &limit );
      mongo_data_append64( data, &cursor->reply->fields.cursorID );

      • bson_free( cursor->reply );
        res = mongo_message_send( cursor->conn, mm );
        if( res != MONGO_OK ) { - mongo_cursor_destroy( cursor ); return MONGO_ERROR; }

        res = mongo_read_response( cursor->conn, &( cursor->reply ) );
        if( res != MONGO_OK ) {- mongo_cursor_destroy( cursor ); return MONGO_ERROR; }

        cursor->current.data = NULL;

            Assignee:
            gjmurakami Gary Murakami
            Reporter:
            basic70 Daniel Brahneborg
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: