qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

oslib-posix:Fix handle fd leak in qemu_write_pidfile()


From: AlexChen
Subject: oslib-posix:Fix handle fd leak in qemu_write_pidfile()
Date: Wed, 26 Aug 2020 18:14:48 +0800
User-agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:17.0) Gecko/20130509 Thunderbird/17.0.6

From: alexchen <alex.chen@huawei.com>

The fd will leak when (a.st_ino == b.st_ino) is true, fix it.

Signed-off-by: AlexChen <alex.chen@huawei.com>
---
 util/oslib-posix.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/util/oslib-posix.c b/util/oslib-posix.c
index ad8001a4ad..74cf5e9c73 100644
--- a/util/oslib-posix.c
+++ b/util/oslib-posix.c
@@ -176,6 +176,7 @@ bool qemu_write_pidfile(const char *path, Error **errp)
         goto fail_unlink;
     }

+    close(fd);
     return true;

 fail_unlink:
-- 
2.19.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]