diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2012-03-08 13:23:15 +0000 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2012-03-08 13:23:15 +0000 |
commit | 3b3d9ca4e1fa0a4f566cb2a8008540ee640b738b (patch) | |
tree | e8ffea16caf9cd0a6a2d4d7bb596c3cb91146dbc /daemon/debug.c | |
parent | 4dd26c28a3786f756c20f204488bfbcfc5e75309 (diff) | |
download | libguestfs-3b3d9ca4e1fa0a4f566cb2a8008540ee640b738b.tar.gz libguestfs-3b3d9ca4e1fa0a4f566cb2a8008540ee640b738b.tar.xz libguestfs-3b3d9ca4e1fa0a4f566cb2a8008540ee640b738b.zip |
daemon: debug: Close fd along error path (found by Coverity).
Error: RESOURCE_LEAK:
/builddir/build/BUILD/libguestfs-1.16.5/daemon/debug.c:469: open_fn: Calling opening function "open".
/builddir/build/BUILD/libguestfs-1.16.5/daemon/debug.c:469: var_assign: Assigning: "fd" = handle returned from "open("/proc/sys/kernel/core_pattern", 1)".
/builddir/build/BUILD/libguestfs-1.16.5/daemon/debug.c:474: noescape: Variable "fd" is not closed or saved in function "write".
/builddir/build/BUILD/libguestfs-1.16.5/daemon/debug.c:476: leaked_handle: Handle variable "fd" going out of scope leaks the handle.
Diffstat (limited to 'daemon/debug.c')
-rw-r--r-- | daemon/debug.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/daemon/debug.c b/daemon/debug.c index 522012f2..4036af68 100644 --- a/daemon/debug.c +++ b/daemon/debug.c @@ -473,6 +473,7 @@ debug_core_pattern (const char *subcmd, int argc, char *const *const argv) } if (write (fd, pattern, pattern_len) < (ssize_t) pattern_len) { reply_with_perror ("write: " CORE_PATTERN); + close (fd); return NULL; } if (close (fd) == -1) { |