提交 e3b21ef9 编写于 作者: M Max Reitz 提交者: Stefan Hajnoczi

qcow2: Free allocated L2 cluster on error

If an error occurs in l2_allocate, the allocated (but unused) L2 cluster
should be freed.
Signed-off-by: NMax Reitz <mreitz@redhat.com>
Reviewed-by: NBenoit Canet <benoit@irqsave.net>
Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
上级 fda74f82
......@@ -273,6 +273,10 @@ fail:
qcow2_cache_put(bs, s->l2_table_cache, (void**) table);
}
s->l1_table[l1_index] = old_l2_offset;
if (l2_offset > 0) {
qcow2_free_clusters(bs, l2_offset, s->l2_size * sizeof(uint64_t),
QCOW2_DISCARD_ALWAYS);
}
return ret;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册