When calling create_header, create_dump_bitmap and create_pages, some memory spaces are allocated. The following patch will use this function to free these spaces.
Signed-off-by: Qiao Nuohan <qiaonuo...@cn.fujitsu.com> Reviewed-by: Zhang Xiaohe <zhan...@cn.fujitsu.com> --- dump.c | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-) diff --git a/dump.c b/dump.c index 6f86359..c372113 100644 --- a/dump.c +++ b/dump.c @@ -1246,6 +1246,23 @@ cleanup: return -1; } +static void clean_state(DumpState *s) +{ + if (s->dh) + g_free(s->dh); + + if (s->kh) + g_free(s->kh); + + free_dump_bitmap(s->dump_bitmap1); + + free_dump_bitmap(s->dump_bitmap2); + + free_cache_data(s->page_desc); + + free_cache_data(s->page_data); +} + void qmp_dump_guest_memory(bool paging, const char *file, bool has_begin, int64_t begin, bool has_length, int64_t length, Error **errp) -- 1.7.1