@@ -2635,7 +2635,7 @@ int save_snapshot(const char *name, Error **errp)
{
BlockDriverState *bs, *bs1;
QEMUSnapshotInfo sn1, *sn = &sn1, old_sn1, *old_sn = &old_sn1;
- int ret = -1;
+ int ret = -1, ret2;
QEMUFile *f;
int saved_vm_running;
uint64_t vm_state_size;
@@ -2719,10 +2719,14 @@ int save_snapshot(const char *name, Error **errp)
}
ret = qemu_savevm_state(f, errp);
vm_state_size = qemu_ftell(f);
- qemu_fclose(f);
+ ret2 = qemu_fclose(f);
if (ret < 0) {
goto the_end;
}
+ if (ret2 < 0) {
+ ret = ret2;
+ goto the_end;
+ }
/* The bdrv_all_create_snapshot() call that follows acquires the AioContext
* for itself. BDRV_POLL_WHILE() does not support nested locking because