[Qemu-devel] [PATCH] misc: edu: free dma timer in device unit

Li Qiang posted 1 patch 7 years, 2 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/589a933e.54c0620a.e6952.a4c6@mx.google.com
Test checkpatch passed
Test docker passed
Test s390x passed
hw/misc/edu.c | 1 +
1 file changed, 1 insertion(+)
[Qemu-devel] [PATCH] misc: edu: free dma timer in device unit
Posted by Li Qiang 7 years, 2 months ago
From: Li Qiang <liqiang6-s@360.cn>

This can avoid a memory leak when hotplug and unplug.

Signed-off-by: Li Qiang <liqiang6-s@360.cn>
---
 hw/misc/edu.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/misc/edu.c b/hw/misc/edu.c
index 401039c..7565552 100644
--- a/hw/misc/edu.c
+++ b/hw/misc/edu.c
@@ -375,6 +375,7 @@ static void pci_edu_uninit(PCIDevice *pdev)
     qemu_mutex_destroy(&edu->thr_mutex);
 
     timer_del(&edu->dma_timer);
+    timer_free(&edu->dma_timer);
 }
 
 static void edu_obj_uint64(Object *obj, Visitor *v, const char *name,
-- 
1.8.3.1


Re: [Qemu-devel] [PATCH] misc: edu: free dma timer in device unit
Posted by Jiri Slaby 7 years, 2 months ago
On 02/08/2017, 04:40 AM, Li Qiang wrote:
> From: Li Qiang <liqiang6-s@360.cn>
> 
> This can avoid a memory leak when hotplug and unplug.
> 
> Signed-off-by: Li Qiang <liqiang6-s@360.cn>
> ---
>  hw/misc/edu.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/hw/misc/edu.c b/hw/misc/edu.c
> index 401039c..7565552 100644
> --- a/hw/misc/edu.c
> +++ b/hw/misc/edu.c
> @@ -375,6 +375,7 @@ static void pci_edu_uninit(PCIDevice *pdev)
>      qemu_mutex_destroy(&edu->thr_mutex);
>  
>      timer_del(&edu->dma_timer);
> +    timer_free(&edu->dma_timer);

Freeing a static timer does not sound correct to me?

thanks,
-- 
js
suse labs

Re: [Qemu-devel] [PATCH] misc: edu: free dma timer in device unit
Posted by Li Qiang 7 years, 2 months ago
2017-02-08 14:53 GMT+08:00 Jiri Slaby <jslaby@suse.cz>:

> On 02/08/2017, 04:40 AM, Li Qiang wrote:
> > From: Li Qiang <liqiang6-s@360.cn>
> >
> > This can avoid a memory leak when hotplug and unplug.
> >
> > Signed-off-by: Li Qiang <liqiang6-s@360.cn>
> > ---
> >  hw/misc/edu.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/hw/misc/edu.c b/hw/misc/edu.c
> > index 401039c..7565552 100644
> > --- a/hw/misc/edu.c
> > +++ b/hw/misc/edu.c
> > @@ -375,6 +375,7 @@ static void pci_edu_uninit(PCIDevice *pdev)
> >      qemu_mutex_destroy(&edu->thr_mutex);
> >
> >      timer_del(&edu->dma_timer);
> > +    timer_free(&edu->dma_timer);
>
> Freeing a static timer does not sound correct to me?
>
>
Sorry, as there is a few example that doesn't free timer, I don't notice
this is a static timer.


> thanks,
> --
> js
> suse labs
>