summaryrefslogtreecommitdiffstats
path: root/daemon
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-03-08 11:41:13 +0000
committerRichard W.M. Jones <rjones@redhat.com>2012-03-08 13:21:58 +0000
commitfbf10d7f682178a6a71cfa8dbac2acd23f869597 (patch)
tree8f3baeb293dafe2749d6c4b22660ac233829c02a /daemon
parentcba36e730524525b5fc1c0df2ec3dd878d55ff15 (diff)
downloadlibguestfs-fbf10d7f682178a6a71cfa8dbac2acd23f869597.tar.gz
libguestfs-fbf10d7f682178a6a71cfa8dbac2acd23f869597.tar.xz
libguestfs-fbf10d7f682178a6a71cfa8dbac2acd23f869597.zip
daemon: upload: Close fd along error path (found by Coverity).
Error: RESOURCE_LEAK: /builddir/build/BUILD/libguestfs-1.16.5/daemon/upload.c:225: open_fn: Calling opening function "open". /builddir/build/BUILD/libguestfs-1.16.5/daemon/upload.c:225: var_assign: Assigning: "fd" = handle returned from "open(filename, 0)". /builddir/build/BUILD/libguestfs-1.16.5/daemon/upload.c:233: noescape: Variable "fd" is not closed or saved in function "lseek". /builddir/build/BUILD/libguestfs-1.16.5/daemon/upload.c:235: leaked_handle: Handle variable "fd" going out of scope leaks the handle.
Diffstat (limited to 'daemon')
-rw-r--r--daemon/upload.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/daemon/upload.c b/daemon/upload.c
index dffe4119..2f3e5b5b 100644
--- a/daemon/upload.c
+++ b/daemon/upload.c
@@ -232,6 +232,7 @@ do_download_offset (const char *filename, int64_t offset, int64_t size)
if (offset) {
if (lseek (fd, offset, SEEK_SET) == -1) {
reply_with_perror ("lseek: %s", filename);
+ close (fd);
return -1;
}
}