Joerg Schad created MESOS-6152:
----------------------------------
Summary: Resource leak in libevent_ssl_socket.cpp.
Key: MESOS-6152
URL: https://issues.apache.org/jira/browse/MESOS-6152
Project: Mesos
Issue Type: Bug
Reporter: Joerg Schad
Assignee: Benjamin Bannier
Coverity detected the following resource leak.
IMO {code} if (fd == -1) {code} should be {code} if (owned_fd == -1) {code}.
{code}
// 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 }
{code}
https://scan5.coverity.com/reports.htm#v39597/p10429/fileInstanceId=98881747&defectInstanceId=28450468
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)