aboutsummaryrefslogtreecommitdiff
path: root/hw/rdma
diff options
context:
space:
mode:
authorPrasad J Pandit <pjp@fedoraproject.org>2018-12-12 23:28:17 +0530
committerMarcel Apfelbaum <marcel.apfelbaum@gmail.com>2018-12-22 11:09:57 +0200
commitcce648613bc802be1b894227f7fd94d88476ea07 (patch)
tree7b1f0cf065ac6c7c676a9d8b36e756ea4c7d54ff /hw/rdma
parent46b69a88241a1e8339a3ffd05050cd418808c71d (diff)
downloadqemu-cce648613bc802be1b894227f7fd94d88476ea07.zip
qemu-cce648613bc802be1b894227f7fd94d88476ea07.tar.gz
qemu-cce648613bc802be1b894227f7fd94d88476ea07.tar.bz2
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 <liq3ea@163.com> Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org> Message-Id: <20181212175817.815-1-ppandit@redhat.com> Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com> Signed-off-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Diffstat (limited to 'hw/rdma')
-rw-r--r--hw/rdma/vmw/pvrdma_main.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/hw/rdma/vmw/pvrdma_main.c b/hw/rdma/vmw/pvrdma_main.c
index 23dc992..64de16f 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");
}
}