[libvirt] [PATCH 1/3] qemuDomainGetResctrlMonData: Don't leak @caps

Michal Privoznik posted 3 patches 5 years, 3 months ago
[libvirt] [PATCH 1/3] qemuDomainGetResctrlMonData: Don't leak @caps
Posted by Michal Privoznik 5 years, 3 months ago
The capabilities object must be unrefed when no longer needed.
use VIR_AUTOUNREF() for that.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/qemu/qemu_driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 3c5ec848ba..d5a8beb134 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -20737,7 +20737,7 @@ qemuDomainGetResctrlMonData(virQEMUDriverPtr driver,
     virDomainResctrlDefPtr resctrl = NULL;
     virQEMUResctrlMonDataPtr res = NULL;
     char **features = NULL;
-    virCapsPtr caps = NULL;
+    VIR_AUTOUNREF(virCapsPtr) caps = NULL;
     size_t i = 0;
     size_t j = 0;
 
-- 
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/3] qemuDomainGetResctrlMonData: Don't leak @caps
Posted by Ján Tomko 5 years, 3 months ago
On Tue, Aug 06, 2019 at 01:47:44PM +0200, Michal Privoznik wrote:
>The capabilities object must be unrefed when no longer needed.
>use VIR_AUTOUNREF() for that.

s/use/Use/
or
s/needed./needed;/

>
>Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
>---
> src/qemu/qemu_driver.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
>index 3c5ec848ba..d5a8beb134 100644
>--- a/src/qemu/qemu_driver.c
>+++ b/src/qemu/qemu_driver.c
>@@ -20737,7 +20737,7 @@ qemuDomainGetResctrlMonData(virQEMUDriverPtr driver,
>     virDomainResctrlDefPtr resctrl = NULL;
>     virQEMUResctrlMonDataPtr res = NULL;
>     char **features = NULL;
>-    virCapsPtr caps = NULL;
>+    VIR_AUTOUNREF(virCapsPtr) caps = NULL;
>     size_t i = 0;
>     size_t j = 0;
>
>-- 
>2.21.0
>
>--
>libvir-list mailing list
>libvir-list@redhat.com
>https://www.redhat.com/mailman/listinfo/libvir-list
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list