Spotted by Coverity. Signed-off-by: Markus Armbruster <arm...@redhat.com> --- os-posix.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/os-posix.c b/os-posix.c index dbf3b24..dc4a6bb 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; } -- 1.7.6.4