Commit 54c16572a03e3c9c5694653361f9bfa3959fcb59

Authored by aliguori
1 parent 7f48fa1f

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
Showing 1 changed file with 1 additions and 0 deletions
block-qcow2.c
... ... @@ -2024,6 +2024,7 @@ static int qcow_snapshot_create(BlockDriverState *bs,
2024 2024 if (!snapshots1)
2025 2025 goto fail;
2026 2026 memcpy(snapshots1, s->snapshots, s->nb_snapshots * sizeof(QCowSnapshot));
  2027 + qemu_free(s->snapshots);
2027 2028 s->snapshots = snapshots1;
2028 2029 s->snapshots[s->nb_snapshots++] = *sn;
2029 2030  
... ...