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) | |
download | qemu-1bbd1592c89a433e1a0501d582652d54d367ca53.zip qemu-1bbd1592c89a433e1a0501d582652d54d367ca53.tar.gz qemu-1bbd1592c89a433e1a0501d582652d54d367ca53.tar.bz2 |
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
@@ -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; } |