Skip to contentSkip to conversation

qcow2: free old snapshots array upon creation of a new one

PATCH Superseded Uri Lublin 4 participants 4 messages Jan 5, 2009 – Jan 8, 2009

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Uri Lublin

author
#0 lore raw

PATCH 1/1 qcow2: free old snapshots array upon creation of a new one

Don't leak memory

---
 qemu/block-qcow2.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
qemu/block-qcow2.c +1 -0
index b3b5f8f..4a2d0a3 100644
@@ -2021,6 +2021,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;
#1 lore raw
Quoted 6 lines · Uri Lublin

Don't leak memory

---
 qemu/block-qcow2.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

Please don't send patches against kvm-userspace.

Regards,

Anthony Liguori

Quoted 17 lines
qemu/block-qcow2.c +1 -0
index b3b5f8f..4a2d0a3 100644
@@ -2021,6 +2021,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;
#2 lore raw

Hi,

Quoted 9 lines · Anthony Liguori
Quoted 6 lines · Uri Lublin

Don't leak memory

---
 qemu/block-qcow2.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

Please don't send patches against kvm-userspace.

git am -p2 <mbox>

Hth,
Dscho

#3 lore raw
Quoted 14 lines · Johannes Schindelin

Hi,

Quoted 9 lines · Anthony Liguori
Quoted 7 lines · Uri Lublin

Don't leak memory

---
 qemu/block-qcow2.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
Quoted 5 lines
Quoted 2 lines

Please don't send patches against kvm-userspace.

git am -p2 <mbox>

That doesn't test the patch against upstream qemu.

Signature · 1 line
error compiling committee.c: too many arguments to function