xen: Free xenforeignmemory_resource at exit
Because Coverity complains about it and this is one leak that Valgrind reports. Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> Acked-by: Paul Durrant <paul@xen.org> Message-Id: <20210430163742.469739-1-anthony.perard@citrix.com> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
This commit is contained in:
parent
3e81a71c9f
commit
f1e43b6026
@ -108,6 +108,7 @@ typedef struct XenIOState {
|
|||||||
shared_iopage_t *shared_page;
|
shared_iopage_t *shared_page;
|
||||||
shared_vmport_iopage_t *shared_vmport_page;
|
shared_vmport_iopage_t *shared_vmport_page;
|
||||||
buffered_iopage_t *buffered_io_page;
|
buffered_iopage_t *buffered_io_page;
|
||||||
|
xenforeignmemory_resource_handle *fres;
|
||||||
QEMUTimer *buffered_io_timer;
|
QEMUTimer *buffered_io_timer;
|
||||||
CPUState **cpu_by_vcpu_id;
|
CPUState **cpu_by_vcpu_id;
|
||||||
/* the evtchn port for polling the notification, */
|
/* the evtchn port for polling the notification, */
|
||||||
@ -1253,6 +1254,9 @@ static void xen_exit_notifier(Notifier *n, void *data)
|
|||||||
XenIOState *state = container_of(n, XenIOState, exit);
|
XenIOState *state = container_of(n, XenIOState, exit);
|
||||||
|
|
||||||
xen_destroy_ioreq_server(xen_domid, state->ioservid);
|
xen_destroy_ioreq_server(xen_domid, state->ioservid);
|
||||||
|
if (state->fres != NULL) {
|
||||||
|
xenforeignmemory_unmap_resource(xen_fmem, state->fres);
|
||||||
|
}
|
||||||
|
|
||||||
xenevtchn_close(state->xce_handle);
|
xenevtchn_close(state->xce_handle);
|
||||||
xs_daemon_close(state->xenstore);
|
xs_daemon_close(state->xenstore);
|
||||||
@ -1320,7 +1324,6 @@ static void xen_wakeup_notifier(Notifier *notifier, void *data)
|
|||||||
static int xen_map_ioreq_server(XenIOState *state)
|
static int xen_map_ioreq_server(XenIOState *state)
|
||||||
{
|
{
|
||||||
void *addr = NULL;
|
void *addr = NULL;
|
||||||
xenforeignmemory_resource_handle *fres;
|
|
||||||
xen_pfn_t ioreq_pfn;
|
xen_pfn_t ioreq_pfn;
|
||||||
xen_pfn_t bufioreq_pfn;
|
xen_pfn_t bufioreq_pfn;
|
||||||
evtchn_port_t bufioreq_evtchn;
|
evtchn_port_t bufioreq_evtchn;
|
||||||
@ -1332,12 +1335,12 @@ static int xen_map_ioreq_server(XenIOState *state)
|
|||||||
*/
|
*/
|
||||||
QEMU_BUILD_BUG_ON(XENMEM_resource_ioreq_server_frame_bufioreq != 0);
|
QEMU_BUILD_BUG_ON(XENMEM_resource_ioreq_server_frame_bufioreq != 0);
|
||||||
QEMU_BUILD_BUG_ON(XENMEM_resource_ioreq_server_frame_ioreq(0) != 1);
|
QEMU_BUILD_BUG_ON(XENMEM_resource_ioreq_server_frame_ioreq(0) != 1);
|
||||||
fres = xenforeignmemory_map_resource(xen_fmem, xen_domid,
|
state->fres = xenforeignmemory_map_resource(xen_fmem, xen_domid,
|
||||||
XENMEM_resource_ioreq_server,
|
XENMEM_resource_ioreq_server,
|
||||||
state->ioservid, 0, 2,
|
state->ioservid, 0, 2,
|
||||||
&addr,
|
&addr,
|
||||||
PROT_READ | PROT_WRITE, 0);
|
PROT_READ | PROT_WRITE, 0);
|
||||||
if (fres != NULL) {
|
if (state->fres != NULL) {
|
||||||
trace_xen_map_resource_ioreq(state->ioservid, addr);
|
trace_xen_map_resource_ioreq(state->ioservid, addr);
|
||||||
state->buffered_io_page = addr;
|
state->buffered_io_page = addr;
|
||||||
state->shared_page = addr + TARGET_PAGE_SIZE;
|
state->shared_page = addr + TARGET_PAGE_SIZE;
|
||||||
|
@ -134,6 +134,12 @@ static inline xenforeignmemory_resource_handle *xenforeignmemory_map_resource(
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline int xenforeignmemory_unmap_resource(
|
||||||
|
xenforeignmemory_handle *fmem, xenforeignmemory_resource_handle *fres)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_XEN_CTRL_INTERFACE_VERSION < 41100 */
|
#endif /* CONFIG_XEN_CTRL_INTERFACE_VERSION < 41100 */
|
||||||
|
|
||||||
#if CONFIG_XEN_CTRL_INTERFACE_VERSION < 41000
|
#if CONFIG_XEN_CTRL_INTERFACE_VERSION < 41000
|
||||||
|
Loading…
x
Reference in New Issue
Block a user