Skip to content

Commit

Permalink
qga: fix file descriptor leak
Browse files Browse the repository at this point in the history
The file descriptor for /sys/power/state was never closed.  Reported
by Coverity.

Signed-off-by: Paolo Bonzini <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Michael Roth <[email protected]>
  • Loading branch information
bonzini authored and mdroth committed Jul 16, 2018
1 parent bb23a73 commit d9c745c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions qga/commands-posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -1652,6 +1652,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;
}
Expand Down

0 comments on commit d9c745c

Please sign in to comment.