[libvirt] [PATCH] qemu: Fix memory leak in processGuestPanicEvent

John Ferlan posted 1 patch 6 years, 2 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20180126204343.1110-1-jferlan@redhat.com
src/qemu/qemu_driver.c | 1 +
1 file changed, 1 insertion(+)
[libvirt] [PATCH] qemu: Fix memory leak in processGuestPanicEvent
Posted by John Ferlan 6 years, 2 months ago
After processing the processEvent->data for a qemuProcessEventHandler
callout, it's expected that the called processEvent->eventType helper
will perform the proper free on the data field. In this case it's
a qemuMonitorEventPanicInfoPtr.

Signed-off-by: John Ferlan <jferlan@redhat.com>
---

 Noticed this while working through the DumpComplete patch series.
 One has to follow the bouncing ball, but will note that when the
 processEvent->data is passed to other cases, it ends up getting
 VIR_FREE()'d at the end of various functions, so this should too
 since it's at the end of the line.

 src/qemu/qemu_driver.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index a203c9297..5eaf97a46 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4309,6 +4309,7 @@ processGuestPanicEvent(virQEMUDriverPtr driver,
         qemuDomainRemoveInactiveJob(driver, vm);
 
  cleanup:
+    qemuMonitorEventPanicInfoFree(info);
     virObjectUnref(cfg);
 }
 
-- 
2.13.6

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: Fix memory leak in processGuestPanicEvent
Posted by Michal Privoznik 6 years, 2 months ago
On 01/26/2018 09:43 PM, John Ferlan wrote:
> After processing the processEvent->data for a qemuProcessEventHandler
> callout, it's expected that the called processEvent->eventType helper
> will perform the proper free on the data field. In this case it's
> a qemuMonitorEventPanicInfoPtr.
> 
> Signed-off-by: John Ferlan <jferlan@redhat.com>
> ---
> 
>  Noticed this while working through the DumpComplete patch series.
>  One has to follow the bouncing ball, but will note that when the
>  processEvent->data is passed to other cases, it ends up getting
>  VIR_FREE()'d at the end of various functions, so this should too
>  since it's at the end of the line.
> 
>  src/qemu/qemu_driver.c | 1 +
>  1 file changed, 1 insertion(+)

ACK

Michal

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list