diff options
Diffstat (limited to 'block')
-rw-r--r-- | block/qcow2.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/block/qcow2.c b/block/qcow2.c index a6de9b6919..33f329992f 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; |