savevm: Fix memory leak of vmstate_configuration
commit39f633d429f249db4f5d2eff7f56381517c7531e
authorJinhao Gao <gaojinhao@huawei.com>
Thu, 31 Dec 2020 06:10:19 +0000 (31 14:10 +0800)
committerDr. David Alan Gilbert <dgilbert@redhat.com>
Mon, 8 Feb 2021 11:19:51 +0000 (8 11:19 +0000)
treec151fbd63d84a27799447d212c0cdbf6fef125f8
parente6ddad1fd53e6e4d65726e41c7063900a69ab694
savevm: Fix memory leak of vmstate_configuration

When VM migrate VMState of configuration, the fields(name and capabilities)
of configuration having a flag of VMS_ALLOC need to allocate memory. If the
src doesn't free memory of capabilities in SaveState after save VMState of
configuration, or the dst doesn't free memory of name and capabilities in post
load of configuration, it may result in memory leak of name and capabilities.
We free memory in configuration_post_save and configuration_post_load func,
which prevents memory leak.

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Jinhao Gao <gaojinhao@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Message-Id: <20201231061020.828-3-gaojinhao@huawei.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
migration/savevm.c