diff options
author | Spenser Reinhardt <sreinhardt@nagios.com> | 2014-06-23 18:54:39 (GMT) |
---|---|---|
committer | Jan Wagner <waja@cyconet.org> | 2014-06-28 16:24:46 (GMT) |
commit | 9123f6146c5dd3285d8fb78cf3a8cd52bad17ec1 (patch) | |
tree | dd0ddcb6462a0f65d3d6fead5a29d5e3d945152f /lib | |
parent | aa16beb9711c1a235259401e8883f5d807a0a11d (diff) | |
download | monitoring-plugins-9123f6146c5dd3285d8fb78cf3a8cd52bad17ec1.tar.gz |
lib/utils_cmd.c - Free file descriptorrefs/pull/1263/head
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.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/utils_cmd.c b/lib/utils_cmd.c index 4c6d0be..9e214bd 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 | } |