mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-06 17:17:56 +03:00
virNWFilterBindingDefCopy: Use automatic memory management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
3f2dcd7f14
commit
c8efa1d223
@ -49,9 +49,7 @@ virNWFilterBindingDefFree(virNWFilterBindingDef *def)
|
|||||||
virNWFilterBindingDef *
|
virNWFilterBindingDef *
|
||||||
virNWFilterBindingDefCopy(virNWFilterBindingDef *src)
|
virNWFilterBindingDefCopy(virNWFilterBindingDef *src)
|
||||||
{
|
{
|
||||||
virNWFilterBindingDef *ret;
|
g_autoptr(virNWFilterBindingDef) ret = g_new0(virNWFilterBindingDef, 1);
|
||||||
|
|
||||||
ret = g_new0(virNWFilterBindingDef, 1);
|
|
||||||
|
|
||||||
ret->ownername = g_strdup(src->ownername);
|
ret->ownername = g_strdup(src->ownername);
|
||||||
|
|
||||||
@ -70,10 +68,9 @@ virNWFilterBindingDefCopy(virNWFilterBindingDef *src)
|
|||||||
if (virNWFilterHashTablePutAll(src->filterparams, ret->filterparams) < 0)
|
if (virNWFilterHashTablePutAll(src->filterparams, ret->filterparams) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
return ret;
|
return g_steal_pointer(&ret);
|
||||||
|
|
||||||
error:
|
error:
|
||||||
virNWFilterBindingDefFree(ret);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user