1--- block-qcow2.c 2006/08/07 02:38:06 1.4 2+++ block-qcow2.c 2007/04/02 12:48:47 1.6 3@@ -1886,6 +1886,8 @@ 4 int64_t table_offset; 5 uint64_t data64; 6 uint32_t data32; 7+ int old_table_size; 8+ int64_t old_table_offset; 9 10 if (min_size <= s->refcount_table_size) 11 return 0; 12@@ -1931,10 +1933,14 @@ 13 &data32, sizeof(data32)) != sizeof(data32)) 14 goto fail; 15 qemu_free(s->refcount_table); 16+ old_table_offset = s->refcount_table_offset; 17+ old_table_size = s->refcount_table_size; 18 s->refcount_table = new_table; 19 s->refcount_table_size = new_table_size; 20+ s->refcount_table_offset = table_offset; 21 22 update_refcount(bs, table_offset, new_table_size2, 1); 23+ free_clusters(bs, old_table_offset, old_table_size * sizeof(uint64_t)); 24 return 0; 25 fail: 26 free_clusters(bs, table_offset, new_table_size2); 27