diff mbox

misc: edu: free dma timer in device unit

Message ID 589a933e.54c0620a.e6952.a4c6@mx.google.com (mailing list archive)
State New, archived
Headers show

Commit Message

Li Qiang Feb. 8, 2017, 3:40 a.m. UTC
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(+)

Comments

Jiri Slaby Feb. 8, 2017, 6:53 a.m. UTC | #1
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,
Li Qiang Feb. 8, 2017, 6:58 a.m. UTC | #2
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
>
diff mbox

Patch

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,