diff options
author | Markus Armbruster <armbru@redhat.com> | 2011-11-11 10:40:09 +0100 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2011-11-11 12:49:52 -0600 |
commit | 1bbd1592c89a433e1a0501d582652d54d367ca53 (patch) | |
tree | 693e60b3fd615b9b3a5ac22f168e362129d775d5 /os-posix.c | |
parent | 095ed5be7b61b7168020f0b807c9789b277a3956 (diff) |
os-posix: Plug fd leak in qemu_create_pidfile()
Spotted by Coverity.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'os-posix.c')
-rw-r--r-- | os-posix.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/os-posix.c b/os-posix.c index dbf3b240f7..dc4a6bb3ff 100644 --- a/os-posix.c +++ b/os-posix.c @@ -372,13 +372,16 @@ int qemu_create_pidfile(const char *filename) return -1; } if (lockf(fd, F_TLOCK, 0) == -1) { + close(fd); return -1; } len = snprintf(buffer, sizeof(buffer), FMT_pid "\n", getpid()); if (write(fd, buffer, len) != len) { + close(fd); return -1; } + close(fd); return 0; } |