qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [COMMIT eb0b64f] Do not attempt to allocate sn_tab when t


From: Anthony Liguori
Subject: [Qemu-commits] [COMMIT eb0b64f] Do not attempt to allocate sn_tab when there are nosnapshots
Date: Thu, 21 May 2009 01:44:16 -0000

From: malc <address@hidden>

This was caught by a7d27b536ffc0773028a90f14580552c0c3ddb2a which
aborted on this attempt, thanks to Alex Ivanov for report.

Signed-off-by: malc <address@hidden>

diff --git a/block/qcow2.c b/block/qcow2.c
index a6de9b6..33f3299 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -2259,6 +2259,11 @@ static int qcow_snapshot_list(BlockDriverState *bs,
     QCowSnapshot *sn;
     int i;
 
+    if (!s->nb_snapshots) {
+        *psn_tab = NULL;
+        return s->nb_snapshots;
+    }
+
     sn_tab = qemu_mallocz(s->nb_snapshots * sizeof(QEMUSnapshotInfo));
     for(i = 0; i < s->nb_snapshots; i++) {
         sn_info = sn_tab + i;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]