From: Prasad J Pandit Date: Wed, 12 Dec 2018 17:58:17 +0000 (+0530) Subject: pvrdma: release device resources in case of an error X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=cce648613bc802be1b894227f7fd94d88476ea07;p=qmiga%2Fqemu.git pvrdma: release device resources in case of an error If during pvrdma device initialisation an error occurs, pvrdma_realize() does not release memory resources, leading to memory leakage. Reported-by: Li Qiang Signed-off-by: Prasad J Pandit Message-Id: <20181212175817.815-1-ppandit@redhat.com> Reviewed-by: Yuval Shaia Signed-off-by: Marcel Apfelbaum --- diff --git a/hw/rdma/vmw/pvrdma_main.c b/hw/rdma/vmw/pvrdma_main.c index 23dc9926e3..64de16fb52 100644 --- a/hw/rdma/vmw/pvrdma_main.c +++ b/hw/rdma/vmw/pvrdma_main.c @@ -573,7 +573,7 @@ static void pvrdma_shutdown_notifier(Notifier *n, void *opaque) static void pvrdma_realize(PCIDevice *pdev, Error **errp) { - int rc; + int rc = 0; PVRDMADev *dev = PVRDMA_DEV(pdev); Object *memdev_root; bool ram_shared = false; @@ -649,6 +649,7 @@ static void pvrdma_realize(PCIDevice *pdev, Error **errp) out: if (rc) { + pvrdma_fini(pdev); error_append_hint(errp, "Device fail to load\n"); } }