Uploaded image for project: 'Mesos'
  1. Mesos
  2. MESOS-6152

Resource leak in libevent_ssl_socket.cpp.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 0.28.3, 1.0.2, 1.1.0
    • None

    Description

      Coverity detected the following resource leak.
      IMO

       if (fd == -1) 

      should be

       if (owned_fd == -1) 

      .

       // Duplicate the file descriptor because Libevent will take ownership
      754  // and control the lifecycle separately.
      755  //
      756  // TODO(josephw): We can avoid duplicating the file descriptor in
      757  // future versions of Libevent. In Libevent versions 2.1.2 and later,
      758  // we may use `evbuffer_file_segment_new` and `evbuffer_add_file_segment`
      759  // instead of `evbuffer_add_file`.
         	3. open_fn: Returning handle opened by dup.
         	4. var_assign: Assigning: owned_fd = handle returned from dup(fd).
      760  int owned_fd = dup(fd);
         	CID 1372873: Argument cannot be negative (REVERSE_NEGATIVE) [select issue]
         	5. Condition fd == -1, taking true branch.
      761  if (fd == -1) {
         	
      CID 1372872 (#1 of 1): Resource leak (RESOURCE_LEAK)
      6. leaked_handle: Handle variable owned_fd going out of scope leaks the handle.
      762    return Failure(ErrnoError("Failed to duplicate file descriptor"));
      763  }
      

      https://scan5.coverity.com/reports.htm#v39597/p10429/fileInstanceId=98881747&defectInstanceId=28450468

      Attachments

        Issue Links

          Activity

            People

              bbannier Benjamin Bannier
              js84 Jörg Schad
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: