[libvirt] [PATCH] CONF: bug, release 'alloc' object in cleanup

Wang Huaqiang posted 1 patch 4 years, 11 months ago
Test syntax-check passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/1556441561-6136-1-git-send-email-huaqiang.wang@intel.com
src/conf/domain_conf.c | 2 ++
1 file changed, 2 insertions(+)
[libvirt] [PATCH] CONF: bug, release 'alloc' object in cleanup
Posted by Wang Huaqiang 4 years, 11 months ago
In case error happens before 'alloc' is transferred to 'resctrl',
the 'alloc' object should be released.

Signed-off-by: Wang Huaqiang <huaqiang.wang@intel.com>
---
 src/conf/domain_conf.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 6331424..7d20276 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -19396,6 +19396,7 @@ virDomainCachetuneDefParse(virDomainDefPtr def,
 
     ret = 0;
  cleanup:
+    virObjectUnref(alloc);
     virDomainResctrlDefFree(resctrl);
     return ret;
 }
@@ -19597,6 +19598,7 @@ virDomainMemorytuneDefParse(virDomainDefPtr def,
 
     ret = 0;
  cleanup:
+    virObjectUnref(alloc);
     virDomainResctrlDefFree(resctrl);
     return ret;
 }
-- 
2.7.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] CONF: bug, release 'alloc' object in cleanup
Posted by Peter Krempa 4 years, 11 months ago
On Sun, Apr 28, 2019 at 16:52:41 +0800, Wang Huaqiang wrote:
> In case error happens before 'alloc' is transferred to 'resctrl',
> the 'alloc' object should be released.

In current upstream it uses VIR_AUTOUNREF, thus the object is unref'd
automatically when exiting the function.
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] CONF: bug, release 'alloc' object in cleanup
Posted by Wang, Huaqiang 4 years, 11 months ago
My bad. 

Thanks. 



> -----Original Message-----
> From: Peter Krempa [mailto:pkrempa@redhat.com]
> Sent: Monday, April 29, 2019 3:00 PM
> To: Wang, Huaqiang <huaqiang.wang@intel.com>
> Cc: libvir-list@redhat.com
> Subject: Re: [libvirt] [PATCH] CONF: bug, release 'alloc' object in cleanup
> 
> On Sun, Apr 28, 2019 at 16:52:41 +0800, Wang Huaqiang wrote:
> > In case error happens before 'alloc' is transferred to 'resctrl', the
> > 'alloc' object should be released.
> 
> In current upstream it uses VIR_AUTOUNREF, thus the object is unref'd
> automatically when exiting the function.

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