Automatically free the variables to prevent leaks when returning from
middle of the function.
Fixes: 1de6fd5edb5
Closes: https://gitlab.com/libvirt/libvirt/-/issues/824
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
{
int ret = -1;
VIR_XPATH_NODE_AUTORESTORE(ctxt)
- char *trunk = NULL;
- xmlNodePtr *tagNodes = NULL;
+ g_autofree char *trunk = NULL;
+ g_autofree xmlNodePtr *tagNodes = NULL;
int nTags;
size_t i;
ret = 0;
cleanup:
- VIR_FREE(tagNodes);
- VIR_FREE(trunk);
return ret;
}