One instance of double closing, and invalid close(-1) in some cases
of "goto error".
Reviewed-by: Laszlo Ersek <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
char *sanitized_name;
char *c;
void *area;
- int fd;
+ int fd = -1;
int64_t page_size;
if (kvm_enabled() && !kvm_has_sync_mmu()) {
if (area == MAP_FAILED) {
error_setg_errno(errp, errno,
"unable to map backing store for guest RAM");
- close(fd);
goto error;
}
if (unlink_on_error) {
unlink(path);
}
- close(fd);
+ if (fd != -1) {
+ close(fd);
+ }
return NULL;
}
#endif