qga: fix file descriptor leak
PATCH 1/1 qga: fix file descriptor leak
The file descriptor for /sys/power/state was never closed. Reported by Coverity.
Signed-off-by Paolo Bonzini <[email protected]>
--- qga/commands-posix.c | 1 + 1 file changed, 1 insertion(+)
qga/commands-posix.c +1 -0
@@ -1651,6 +1651,7 @@ static bool linux_sys_state_supports_mode(SuspendMode mode, Error **errp) } ret =read (fd, buf,sizeof (buf) -1 ); +close (fd);if (ret <=0 ) {return false; }
Signature · 1 line
2.17.1
Quoted 4 lines · Paolo Bonzini
The file descriptor for
/sys/power/statewas never closed. Reported by Coverity.Signed-off-by Paolo Bonzini <[email protected]>
Reviewed-by Philippe Mathieu-Daudé <[email protected]>
Quoted 17 lines
--- qga/commands-posix.c | 1 + 1 file changed, 1 insertion(+)qga/commands-posix.c +1
-0@@ -1651,6 +1651,7 @@ static bool linux_sys_state_supports_mode(SuspendMode mode, Error **errp) } ret =read (fd, buf,sizeof (buf) -1 ); +close (fd);if (ret <=0 ) {return false; }
Michael Roth
AppliedQuoting Paolo Bonzini (2018-07-15 11:21:56)
Quoted 4 lines
The file descriptor for
/sys/power/statewas never closed. Reported by Coverity.Signed-off-by Paolo Bonzini <[email protected]>
Thanks, applied to qga tree:
https://github.com/mdroth/qemu/commits/qga
Quoted 19 lines
--- qga/commands-posix.c | 1 + 1 file changed, 1 insertion(+)qga/commands-posix.c +1
-0@@ -1651,6 +1651,7 @@ static bool linux_sys_state_supports_mode(SuspendMode mode, Error **errp) } ret =read (fd, buf,sizeof (buf) -1 ); +close (fd);if (ret <=0 ) {return false; }Signature · 1 line
2.17.1