util: fix fd leak in qemu_write_pidfile()
PATCH 1/1 util: fix fd leak in qemu_write_pidfile()
if execute qemu_open success, have no branch to free the fd, so unlink it inadvance, let it free by process exit.
--- util/oslib-posix.c | 1 + 1 file changed, 1 insertion(+)
util/oslib-posix.c +1 -0
@@ -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" );
Signature · 1 line
2.23.0
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series seems to have some coding style problems. See output below for more information:
Type: series
Message-id: [email protected]
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/[email protected] -> patchew/[email protected] - [tag update] patchew/[email protected] -> patchew/[email protected] * [new tag] patchew/[email protected] -> patchew/[email protected]
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/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]