summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSpenser Reinhardt <sreinhardt@nagios.com>2014-06-23 13:54:39 -0500
committerJan Wagner <waja@cyconet.org>2014-06-28 18:24:46 +0200
commit9123f6146c5dd3285d8fb78cf3a8cd52bad17ec1 (patch)
treedd0ddcb6462a0f65d3d6fead5a29d5e3d945152f
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
-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)
390 390
391 if(out) 391 if(out)
392 out->lines = _cmd_fetch_output (fd, out, flags); 392 out->lines = _cmd_fetch_output (fd, out, flags);
393
394 if (close(fd) == -1)
395 die( STATE_UNKNOWN, _("Error closing %s: %s"), filename, strerror(errno) );
393 396
394 return 0; 397 return 0;
395} 398}