On Fri, Apr 3, 2020 at 5:37 PM Peter Krempa <pkrempa(a)redhat.com> wrote:
On Fri, Apr 03, 2020 at 17:15:29 +0200, Rafael Fonseca wrote:
> Signed-off-by: Rafael Fonseca <r4f4rfs(a)gmail.com>
> ---
> src/conf/capabilities.c | 3 +-
> src/conf/domain_conf.c | 21 +++---
> src/util/virresctrl.c | 137 ++++++++++++++++++++++------------------
> src/util/virresctrl.h | 15 +++--
> tests/virresctrltest.c | 3 +-
> 5 files changed, 97 insertions(+), 82 deletions(-)
>
> diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c
> index 99b69aebb5..2c91461a54 100644
> --- a/src/conf/capabilities.c
> +++ b/src/conf/capabilities.c
> @@ -266,7 +266,8 @@ virCapsDispose(void *object)
> VIR_FREE(caps->host.netprefix);
> VIR_FREE(caps->host.pagesSize);
> virCPUDefFree(caps->host.cpu);
> - virObjectUnref(caps->host.resctrl);
> + if (caps->host.resctrl)
> + g_object_unref(caps->host.resctrl);
Please use g_clear_object without the condition instead of this pattern
everywhere. It was recently discussed on the list that this is the
better option.
Oh, I missed the discussion. I was following this patch example:
https://libvirt.org/git/?p=libvirt.git;a=commitdiff;h=16121a88a7ef933220b...
Anyway I'll replace them by g_clear_object. Tks.
Att
--
Rafael Fonseca