* [PATCH] util: fix fd leak in qemu_write_pidfile()
@ 2021-05-10 9:57 Jie Wang
2021-05-10 10:10 ` no-reply
0 siblings, 1 reply; 2+ messages in thread
From: Jie Wang @ 2021-05-10 9:57 UTC (permalink / raw)
To: qemu-devel; +Cc: wangxinxin.wang, wangjie88
if execute qemu_open success, have no branch to free the fd,
so unlink it inadvance, let it free by process exit.
Signed-off-by: Jie Wang <wangjie88@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 36820fec16..30bf39bf4f 100644
--- a/util/oslib-posix.c
+++ b/util/oslib-posix.c
@@ -131,6 +131,7 @@ bool qemu_write_pidfile(const char *path, Error **errp)
error_setg_errno(errp, errno, "Cannot open pid file");
return false;
}
+ unlink(path);
if (fstat(fd, &b) < 0) {
error_setg_errno(errp, errno, "Cannot stat file");
--
2.23.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] util: fix fd leak in qemu_write_pidfile()
2021-05-10 9:57 [PATCH] util: fix fd leak in qemu_write_pidfile() Jie Wang
@ 2021-05-10 10:10 ` no-reply
0 siblings, 0 replies; 2+ messages in thread
From: no-reply @ 2021-05-10 10:10 UTC (permalink / raw)
To: wangjie88; +Cc: wangxinxin.wang, qemu-devel, wangjie88
Patchew URL: https://patchew.org/QEMU/20210510095708.950474-1-wangjie88@huawei.com/
Hi,
This series seems to have some coding style problems. See output below for
more information:
Type: series
Message-id: 20210510095708.950474-1-wangjie88@huawei.com
Subject: [PATCH] util: fix fd leak in qemu_write_pidfile()
=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
- [tag update] patchew/20210413125533.217440-1-pbonzini@redhat.com -> patchew/20210413125533.217440-1-pbonzini@redhat.com
- [tag update] patchew/20210508014802.892561-1-richard.henderson@linaro.org -> patchew/20210508014802.892561-1-richard.henderson@linaro.org
* [new tag] patchew/20210510095708.950474-1-wangjie88@huawei.com -> patchew/20210510095708.950474-1-wangjie88@huawei.com
Auto packing the repository for optimum performance. You may also
run "git gc" manually. See "git help gc" for more information.
Switched to a new branch 'test'
e5d821e util: fix fd leak in qemu_write_pidfile()
=== OUTPUT BEGIN ===
ERROR: code indent should never use tabs
#24: FILE: util/oslib-posix.c:134:
+^Iunlink(path);$
total: 1 errors, 0 warnings, 7 lines checked
Commit e5d821e6eca2 (util: fix fd leak in qemu_write_pidfile()) has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===
Test command exited with code: 1
The full log is available at
http://patchew.org/logs/20210510095708.950474-1-wangjie88@huawei.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-05-10 10:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-10 9:57 [PATCH] util: fix fd leak in qemu_write_pidfile() Jie Wang
2021-05-10 10:10 ` no-reply
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).