diff options
author | Prasad J Pandit <pjp@fedoraproject.org> | 2018-12-12 23:28:17 +0530 |
---|---|---|
committer | Michael Roth <mdroth@linux.vnet.ibm.com> | 2019-07-30 15:15:46 -0500 |
commit | 1549e3a54ab135b86e7a7cb4b94e9b13665bf648 (patch) | |
tree | 4fcf04026ac64b574b804b638f41ea4e9def3449 | |
parent | 86d4f40141033c0b59c45d818603d8cdc6d555ce (diff) |
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>
(cherry picked from commit cce648613bc802be1b894227f7fd94d88476ea07)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
-rw-r--r-- | hw/rdma/vmw/pvrdma_main.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/hw/rdma/vmw/pvrdma_main.c b/hw/rdma/vmw/pvrdma_main.c index ca5fa8d981..34d8cc4694 100644 --- a/hw/rdma/vmw/pvrdma_main.c +++ b/hw/rdma/vmw/pvrdma_main.c @@ -572,7 +572,7 @@ static int pvrdma_check_ram_shared(Object *obj, 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; @@ -632,6 +632,7 @@ static void pvrdma_realize(PCIDevice *pdev, Error **errp) out: if (rc) { + pvrdma_fini(pdev); error_append_hint(errp, "Device fail to load\n"); } } |