Skip to contentSkip to conversation

misc: edu: free dma timer in device unit

PATCH In review Li Qiang 2 participants 3 messages Feb 8, 2017

lore
Share & tools
lore

Li Qiang

author
#0 lore raw

PATCH 1/1 misc: edu: free dma timer in device unit

From: Li Qiang <[email protected]>

This can avoid a memory leak when hotplug and unplug.

---
 hw/misc/edu.c | 1 +
 1 file changed, 1 insertion(+)
hw/misc/edu.c +1 -0
index 401039c..7565552 100644
@@ -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,
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 14 lines · Li Qiang

From: Li Qiang <[email protected]>

This can avoid a memory leak when hotplug and unplug.

---
 hw/misc/edu.c | 1 +
 1 file changed, 1 insertion(+)
hw/misc/edu.c +0 -0
index 401039c..7565552 100644

hw/misc/edu.c static void pci_edu_uninit(PCIDevice *pdev) · line 378

Quoted 4 lines
hw/misc/edu.c +1 -0
@@ -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,

Signature · 2 lines
js
suse labs
author
#2 lore raw

2017-02-08 14:53 GMT+08:00 Jiri Slaby <[email protected]>:

Quoted 17 lines · Li Qiang
Quoted 16 lines

From: Li Qiang <[email protected]>

This can avoid a memory leak when hotplug and unplug.

---
 hw/misc/edu.c | 1 +
 1 file changed, 1 insertion(+)
hw/misc/edu.c +0 -0
index 401039c..7565552 100644
@@ -375,6 +375,7 @@ static void pci_edu_uninit(PCIDevice *pdev)
     qemu_mutex_destroy(&edu->thr_mutex);
 
Quoted 6 lines

hw/misc/edu.c static void pci_edu_uninit(PCIDevice *pdev) · line 378

Quoted 2 lines
hw/misc/edu.c +1 -0
     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.

Quoted 5 lines

thanks,
--
js
suse labs