Skip to contentSkip to conversation

qcow2: fix leak of Qcow2DiscardRegion in update_refcount_discard

PATCH In review Zhang Haoyu 2 participants 2 messages Oct 11, 2014 – Oct 12, 2014 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qcow2: fix leak of Qcow2DiscardRegion in update_refcount_discard

When the Qcow2DiscardRegion is adjacent to another one referenced by "d", free this Qcow2DiscardRegion metadata referenced by "p" after it was removed from s->discards queue.

---
 block/qcow2-refcount.c | 1 +
 1 file changed, 1 insertion(+)
block/qcow2-refcount.c +1 -0
index 2bcaaf9..c31d85a 100644
@@ -524,6 +524,7 @@ found:
         QTAILQ_REMOVE(&s->discards, p, next);
         d->offset = MIN(d->offset, p->offset);
         d->bytes += p->bytes;
+        g_free(p);
     }
 }
 
Signature · 1 line
1.7.12.4
Reviewed-by on v1 1/1
#1 lore raw

Am 11.10.2014 um 10:35 schrieb Zhang Haoyu:

Quoted 8 lines

When the Qcow2DiscardRegion is adjacent to another one referenced by "d", free this Qcow2DiscardRegion metadata referenced by "p" after it was removed from s->discards queue.

---
  block/qcow2-refcount.c | 1 +
  1 file changed, 1 insertion(+)