Do not attempt to allocate sn_tab when there are no snapshots
This was caught by a7d27b536ffc0773028a90f14580552c0c3ddb2a which aborted on this attempt, thanks to Alex Ivanov for report. Signed-off-by: malc <av1474@comtv.ru>
This commit is contained in:
parent
0a656f5f21
commit
eb0b64f7aa
@ -2259,6 +2259,11 @@ static int qcow_snapshot_list(BlockDriverState *bs,
|
|||||||
QCowSnapshot *sn;
|
QCowSnapshot *sn;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
if (!s->nb_snapshots) {
|
||||||
|
*psn_tab = NULL;
|
||||||
|
return s->nb_snapshots;
|
||||||
|
}
|
||||||
|
|
||||||
sn_tab = qemu_mallocz(s->nb_snapshots * sizeof(QEMUSnapshotInfo));
|
sn_tab = qemu_mallocz(s->nb_snapshots * sizeof(QEMUSnapshotInfo));
|
||||||
for(i = 0; i < s->nb_snapshots; i++) {
|
for(i = 0; i < s->nb_snapshots; i++) {
|
||||||
sn_info = sn_tab + i;
|
sn_info = sn_tab + i;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user