aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGravatar Spenser Reinhardt <sreinhardt@nagios.com> 2014-06-23 13:54:39 -0500
committerGravatar Jan Wagner <waja@cyconet.org> 2014-06-28 18:24:46 +0200
commit9123f6146c5dd3285d8fb78cf3a8cd52bad17ec1 (patch)
treedd0ddcb6462a0f65d3d6fead5a29d5e3d945152f /lib
parentaa16beb9711c1a235259401e8883f5d807a0a11d (diff)
downloadmonitoring-plugins-9123f6146c5dd3285d8fb78cf3a8cd52bad17ec1.tar.gz
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
Diffstat (limited to 'lib')
-rw-r--r--lib/utils_cmd.c3
1 files changed, 3 insertions, 0 deletions
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;
}