diff mbox series

[2/5] Close fd before return to avoid resource leak

Message ID 20180827064233.3218-2-honli@redhat.com (mailing list archive)
State Not Applicable
Delegated to: Hal Rosenstock
Headers show
Series [1/5] Adjust BuildRequires for covscan | expand

Commit Message

Honggang LI Aug. 27, 2018, 6:42 a.m. UTC
From: Honggang Li <honli@redhat.com>

Issue was found by Coverity.

Signed-off-by: Honggang Li <honli@redhat.com>
---
 opensm/main.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Hal Rosenstock Aug. 27, 2018, 4:40 p.m. UTC | #1
On 8/27/2018 2:42 AM, Honggang LI wrote:
> From: Honggang Li <honli@redhat.com>
> 
> Issue was found by Coverity.
> 
> Signed-off-by: Honggang Li <honli@redhat.com>

Thanks. Applied.

-- Hal
diff mbox series

Patch

diff --git a/opensm/main.c b/opensm/main.c
index ba20d985..2d23fe2b 100644
--- a/opensm/main.c
+++ b/opensm/main.c
@@ -565,6 +565,8 @@  static int daemonize(osm_opensm_t * osm)
 	dup2(fd, 1);
 	dup2(fd, 2);
 
+	close(fd);
+
 	return 0;
 }