mirror of
https://github.com/qemu/qemu.git
synced 2024-11-25 11:53:39 +08:00
qcow2: free old snapshots array upon creation of a new one (Uri Lublin)
Don't leak memory Rebased for qemu tree. Signed-off-by: Uri Lublin <uril@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6245 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
7f48fa1f05
commit
54c16572a0
@ -2024,6 +2024,7 @@ static int qcow_snapshot_create(BlockDriverState *bs,
|
||||
if (!snapshots1)
|
||||
goto fail;
|
||||
memcpy(snapshots1, s->snapshots, s->nb_snapshots * sizeof(QCowSnapshot));
|
||||
qemu_free(s->snapshots);
|
||||
s->snapshots = snapshots1;
|
||||
s->snapshots[s->nb_snapshots++] = *sn;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user