aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhang Min <rudy.zhangmin@huawei.com>2014-01-23 15:59:16 +0800
committerKevin Wolf <kwolf@redhat.com>2014-01-24 14:33:00 +0100
commit6df3bf8eb3ed428015c85cfbd554ac9b32164f40 (patch)
tree653dbd3dd966b8dbb3daa771da6d89c6d9b13c82
parent9cd767376f137918dbe90abb452dfe119ae7d8f3 (diff)
drive mirror:fix memory leak
In the function mirror_iteration() -> qemu_iovec_init(), it allocates memory for op->qiov.iov, when the write request calls back, but in the function mirror_iteration_done(), it only frees the op, not free the op->qiov.iov, so this causes memory leak. It should use qemu_iovec_destroy() to free op->qiov. Signed-off-by: Zhang Min <rudy.zhangmin@huawei.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-rw-r--r--block/mirror.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/block/mirror.c b/block/mirror.c
index 2932bab27a..05758e5500 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -96,6 +96,7 @@ static void mirror_iteration_done(MirrorOp *op, int ret)
bitmap_set(s->cow_bitmap, chunk_num, nb_chunks);
}
+ qemu_iovec_destroy(&op->qiov);
g_slice_free(MirrorOp, op);
qemu_coroutine_enter(s->common.co, NULL);
}