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

Coverity analysis defect 72309: Resource leak

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.7.0
    • Affects Version/s: None
    • Component/s: libmongoc
    • Labels:
      None

      Leak of memory or pointers to system resources

      Defect 72309 (STATIC_C)
      Checker RESOURCE_LEAK (subcategory none)
      File: /src/tools/mongoc-stat.c
      Function mongoc_counters_new_from_pid
      /src/tools/mongoc-stat.c, line: 104
      Storage is returned from allocation function "mmap".

             if (MAP_FAILED == (mem = mmap (NULL, size, PROT_READ, MAP_SHARED, fd, 0))) {
      

      /src/tools/mongoc-stat.c, line: 104
      Assigning: "mem" = storage returned from "mmap(NULL, size, 1, 1, fd, 0L)".

             if (MAP_FAILED == (mem = mmap (NULL, size, PROT_READ, MAP_SHARED, fd, 0))) {
      

      /src/tools/mongoc-stat.c, line: 112
      Assigning: "counters" = "mem".

             counters = (mongoc_counters_t *) mem;
      

      /src/tools/mongoc-stat.c, line: 115
      Variable "mem" going out of scope leaks the storage it points to.

                return NULL;
      

      /src/tools/mongoc-stat.c, line: 115
      Variable "counters" going out of scope leaks the storage it points to.

                return NULL;
      

            Assignee:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Reporter:
            xgen-internal-coverity Coverity Collector User
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: