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

Memory leak in mongoc_client_command_simple()

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 1.1.0
    • 1.0.2
    • None
    • None

    Description

      when I call mongoc_database_get_collection_info() a new bson is created:
      https://github.com/mongodb/mongo-c-driver/blob/048c851919dc32c98b5f8a9a0270e69af9385db3/src/mongoc/mongoc-database.c#L741

      the bson correct. But, this bson is sent to mongoc_database_command_simple() and then to mongoc_client_command_simple()

      The issue is this bson is sent to bson_init() :
      https://github.com/mongodb/mongo-c-driver/blob/048c851919dc32c98b5f8a9a0270e69af9385db3/src/mongoc/mongoc-client.c#L1247

      so the flags of this bson changes from BSON_FLAG_INLINE to BSON_FLAG_INLINE | BSON_FLAG_STATIC

      So later when bson_destroy() is called, the buffer is not freed()

      I think bson_reinit() should be called instead. But I'm not sure. I'm not even sure if we need to call something on this bson.

      Attachments

        Activity

          People

            mira.carey@mongodb.com Mira Carey
            jeromelebel Jerome Lebel
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: