[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v6 11/13] libxl: fix memory leak in libxl__colo_save_setup
From: Oleksandr Grytsov <oleksandr_grytsov@xxxxxxxx> Getting nic list in case userspace proxy is called without freeing. The fix is to use cds->nics to keep nic list. cds->nics will be freed in devices_teardown_cb. Signed-off-by: Oleksandr Grytsov <oleksandr_grytsov@xxxxxxxx> --- tools/libxl/libxl_colo_save.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/libxl/libxl_colo_save.c b/tools/libxl/libxl_colo_save.c index bf68198..43f7dbe 100644 --- a/tools/libxl/libxl_colo_save.c +++ b/tools/libxl/libxl_colo_save.c @@ -86,7 +86,6 @@ void libxl__colo_save_setup(libxl__egc *egc, libxl__colo_save_state *css) libxl__checkpoint_devices_state *const cds = &dss->cds; libxl__srm_save_autogen_callbacks *const callbacks = &dss->sws.shs.callbacks.save.a; - libxl_device_nic *nics; STATE_AO_GC(dss->ao); @@ -122,10 +121,12 @@ void libxl__colo_save_setup(libxl__egc *egc, libxl__colo_save_state *css) cds->device_kind_flags = (1 << LIBXL__DEVICE_KIND_VBD); /* Use this args we can connect to qemu colo-compare */ - nics = libxl__device_list(gc, &libxl__nic_devtype, - cds->domid, "vif", &cds->num_nics); - css->cps.checkpoint_host = nics->colo_checkpoint_host; - css->cps.checkpoint_port = nics->colo_checkpoint_port; + cds->nics = libxl__device_list(gc, &libxl__nic_devtype, + cds->domid, "vif", &cds->num_nics); + if (cds->num_nics > 0) { + css->cps.checkpoint_host = cds->nics[0].colo_checkpoint_host; + css->cps.checkpoint_port = cds->nics[0].colo_checkpoint_port; + } } else { cds->device_kind_flags = (1 << LIBXL__DEVICE_KIND_VIF) | (1 << LIBXL__DEVICE_KIND_VBD); -- 2.7.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |