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

Leaks in _mongoc_cluster_ismaster

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.1.10
    • Affects Version/s: 1.1.9
    • Component/s: libmongoc
    • Labels:
      None

      As originally reported, a memory leak in this call stack:

                       libbson-1.0.so.0.0.0`bson_malloc+0xa
                       libbson-1.0.so.0.0.0`bson_copy_to+0xaf
                       libmongoc-1.0.so.0.0.0`_mongoc_cluster_ismaster+0x4cf
                       libmongoc-1.0.so.0.0.0`_mongoc_cluster_reconnect_replica_set+0x496
                       libmongoc-1.0.so.0.0.0`_mongoc_cluster_reconnect+0x2d3
                       libmongoc-1.0.so.0.0.0`_mongoc_cluster_sendv+0xe6
                       libmongoc-1.0.so.0.0.0`_mongoc_cursor_next+0x29c
                       libmongoc-1.0.so.0.0.0`mongoc_cursor_next+0x65
                       libmongoc-1.0.so.0.0.0`mongoc_client_command_simple+0x51
      

      Looking on the code https://github.com/mongodb/mongo-c-driver/blob/a0997439c86276f0dcdb49550636b11f3e407384/src/mongoc/mongoc-cluster.c#L1167
      it seems like that before copying bson to tags - you need to free it first.

            Assignee:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Reporter:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: