diff mbox series

[2/2] nvme: free cmbuf in nvme_exit

Message ID 1540794581-33578-3-git-send-email-liq3ea@gmail.com (mailing list archive)
State New, archived
Headers show
Series nvme: fix two issues in nvme unhotplug | expand

Commit Message

Li Qiang Oct. 29, 2018, 6:29 a.m. UTC
This avoid a memory leak in unhotplug nvme device.

Signed-off-by: Li Qiang <liq3ea@gmail.com>
---
 hw/block/nvme.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Philippe Mathieu-Daudé Oct. 29, 2018, 12:32 p.m. UTC | #1
On 29/10/18 7:29, Li Qiang wrote:
> This avoid a memory leak in unhotplug nvme device.
> 
> Signed-off-by: Li Qiang <liq3ea@gmail.com>

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> ---
>   hw/block/nvme.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/hw/block/nvme.c b/hw/block/nvme.c
> index 359a06d0ad..09d7c90259 100644
> --- a/hw/block/nvme.c
> +++ b/hw/block/nvme.c
> @@ -1332,6 +1332,9 @@ static void nvme_exit(PCIDevice *pci_dev)
>       g_free(n->cq);
>       g_free(n->sq);
>   
> +    if (n->cmb_size_mb) {
> +        g_free(n->cmbuf);
> +    }
>       msix_uninit_exclusive_bar(pci_dev);
>   }
>   
>
diff mbox series

Patch

diff --git a/hw/block/nvme.c b/hw/block/nvme.c
index 359a06d0ad..09d7c90259 100644
--- a/hw/block/nvme.c
+++ b/hw/block/nvme.c
@@ -1332,6 +1332,9 @@  static void nvme_exit(PCIDevice *pci_dev)
     g_free(n->cq);
     g_free(n->sq);
 
+    if (n->cmb_size_mb) {
+        g_free(n->cmbuf);
+    }
     msix_uninit_exclusive_bar(pci_dev);
 }