From 9123f6146c5dd3285d8fb78cf3a8cd52bad17ec1 Mon Sep 17 00:00:00 2001 From: Spenser Reinhardt Date: Mon, 23 Jun 2014 13:54:39 -0500 Subject: lib/utils_cmd.c - Free file descriptor Coverity 66502 - File descriptor fd in cmd_file_read is never closed, and thus file is left open after usage throughout runtime. - SR --- lib/utils_cmd.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib') diff --git a/lib/utils_cmd.c b/lib/utils_cmd.c index 4c6d0be1..9e214bd4 100644 --- a/lib/utils_cmd.c +++ b/lib/utils_cmd.c @@ -390,6 +390,9 @@ cmd_file_read ( char *filename, output *out, int flags) if(out) out->lines = _cmd_fetch_output (fd, out, flags); + + if (close(fd) == -1) + die( STATE_UNKNOWN, _("Error closing %s: %s"), filename, strerror(errno) ); return 0; } -- cgit v1.2.3-74-g34f1