mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-07-16 08:26:41 +00:00
acrn/dm: Remove the memory leak in gvt mediator
Otherwise it causes the memory leak. V1->V2: Fix the leak of pi->arg as gvt structure also needs to be released. Tracked-On: #2762 Signed-off-by: Zhao Yakui <yakui.zhao@intel.com> Reviewed-by: He, Min <min.he@intel.com> Acked-by: Yin Fengwei <fengwei.yin@intel.com>
This commit is contained in:
parent
065e16d32e
commit
31cb4721e1
@ -262,9 +262,18 @@ pci_gvt_deinit(struct vmctx *ctx, struct pci_vdev *pi, char *opts)
|
|||||||
int ret;
|
int ret;
|
||||||
struct pci_gvt *gvt = pi->arg;
|
struct pci_gvt *gvt = pi->arg;
|
||||||
|
|
||||||
|
if (gvt && gvt->host_config) {
|
||||||
|
/* Free the allocated host_config */
|
||||||
|
free(gvt->host_config);
|
||||||
|
gvt->host_config = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
ret = gvt_destroy_instance(gvt);
|
ret = gvt_destroy_instance(gvt);
|
||||||
if (ret)
|
if (ret)
|
||||||
WPRINTF(("GVT: %s: failed: errno=%d\n", __func__, ret));
|
WPRINTF(("GVT: %s: failed: errno=%d\n", __func__, ret));
|
||||||
|
|
||||||
|
free(gvt);
|
||||||
|
pi->arg = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct pci_vdev_ops pci_ops_gvt = {
|
struct pci_vdev_ops pci_ops_gvt = {
|
||||||
|
Loading…
Reference in New Issue
Block a user