projects
/
qemu.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
095ed5b
)
os-posix: Plug fd leak in qemu_create_pidfile()
author
Markus Armbruster
<armbru@redhat.com>
Fri, 11 Nov 2011 09:40:09 +0000
(10:40 +0100)
committer
Anthony Liguori
<aliguori@us.ibm.com>
Fri, 11 Nov 2011 18:49:52 +0000
(12:49 -0600)
Spotted by Coverity.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
os-posix.c
patch
|
blob
|
history
diff --git
a/os-posix.c
b/os-posix.c
index dbf3b240f73aedb810f9d4950c2acf6dfccf5d5f..dc4a6bb3fffa98d80144284412e7b575f72d914e 100644
(file)
--- 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;
}