On Thu, Dec 03, 2020 at 02:25:22PM +0000, Paul Durrant wrote:
> From: Paul Durrant <pdurr...@amazon.com>
> 
> A previous patch introduced libxl_device_pci_list_free() which should be used
> by callers of libxl_device_pci_list() to properly dispose of the exported
> 'libxl_device_pci' types and the free the memory holding them. Whilst all
> current callers do ensure the memory is freed, only the code in xl's
> pcilist() function actually calls libxl_device_pci_dispose(). As it stands
> this laxity does not lead to any memory leaks, but the simple addition of
> .e.g. a 'string' into the idl definition of 'libxl_device_pci' would lead
> to leaks.
> 
> This patch makes sure all callers of libxl_device_pci_list() can call
> libxl_device_pci_list_free() by keeping copies of 'libxl_device_pci'
> structures inline in 'pci_add_state' and 'pci_remove_state' (and also making
> sure these are properly disposed at the end of the operations) rather
> than keeping pointers to the structures returned by libxl_device_pci_list().
> 
> Signed-off-by: Paul Durrant <pdurr...@amazon.com>
> Reviewed-by: Oleksandr Andrushchenko <oleksandr_andrushche...@epam.com>

Acked-by: Wei Liu <w...@xen.org>

Reply via email to