We should fail if something goes wrong in the call to
bdrv_snapshot_find().

Currently, we only fail if 'sn.vm_state_size' is not what
we expect it to be.

Signed-off-by: Luiz Capitulino <lcapitul...@redhat.com>
---
 savevm.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/savevm.c b/savevm.c
index 5024829..3ccb246 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1800,8 +1800,11 @@ int load_vmstate(const char *name)
 
     /* Don't even try to load empty VM states */
     ret = bdrv_snapshot_find(bs, &sn, name);
-    if ((ret >= 0) && (sn.vm_state_size == 0))
+    if (ret < 0) {
+        return ret;
+    } else if (sn.vm_state_size == 0) {
         return -EINVAL;
+    }
 
     /* restore the VM state */
     f = qemu_fopen_bdrv(bs, 0);
-- 
1.7.1.rc1.12.ga6018



Reply via email to