mbox series

[v3,0/3] Fix memory leak of some device state in migration

Message ID 20201231061020.828-1-gaojinhao@huawei.com (mailing list archive)
Headers show
Series Fix memory leak of some device state in migration | expand

Message

gaojinhao Dec. 31, 2020, 6:10 a.m. UTC
For some device state having some fields of VMS_ALLOC flag, they
don't free memory allocated for the fields in vmstate_save_state
and vmstate_load_state. We add funcs or sentences of free memory
before and after VM saves or loads device state to avoid memory leak.

v2
 - Drop patch1-3,6-8 of v1
 - Address Michael's comment (free memory before load vmsd centrally)
 - Add David's Acked-by and Michael's Signed-off-by

v3
 - Add Euler's Reported-by and Michael's Reviewed-by

Jinhao Gao (3):
  spapr_pci: Fix memory leak of vmstate_spapr_pci
  savevm: Fix memory leak of vmstate_configuration
  vmstate: Fix memory leak in vmstate_handle_alloc()

 hw/ppc/spapr_pci.c  | 11 +++++++++++
 migration/savevm.c  | 31 +++++++++++++++++++++++++++----
 migration/vmstate.c |  1 +
 3 files changed, 39 insertions(+), 4 deletions(-)

Comments

Dr. David Alan Gilbert Feb. 4, 2021, 2:26 p.m. UTC | #1
* Jinhao Gao (gaojinhao@huawei.com) wrote:
> For some device state having some fields of VMS_ALLOC flag, they
> don't free memory allocated for the fields in vmstate_save_state
> and vmstate_load_state. We add funcs or sentences of free memory
> before and after VM saves or loads device state to avoid memory leak.

Queued

> 
> v2
>  - Drop patch1-3,6-8 of v1
>  - Address Michael's comment (free memory before load vmsd centrally)
>  - Add David's Acked-by and Michael's Signed-off-by
> 
> v3
>  - Add Euler's Reported-by and Michael's Reviewed-by
> 
> Jinhao Gao (3):
>   spapr_pci: Fix memory leak of vmstate_spapr_pci
>   savevm: Fix memory leak of vmstate_configuration
>   vmstate: Fix memory leak in vmstate_handle_alloc()
> 
>  hw/ppc/spapr_pci.c  | 11 +++++++++++
>  migration/savevm.c  | 31 +++++++++++++++++++++++++++----
>  migration/vmstate.c |  1 +
>  3 files changed, 39 insertions(+), 4 deletions(-)
> 
> -- 
> 2.23.0
> 
>