1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-05 13:17:51 +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:
Tim Wiederhake 2021-07-06 10:11:19 +02:00
parent 3f2dcd7f14
commit c8efa1d223

View File

@ -49,9 +49,7 @@ virNWFilterBindingDefFree(virNWFilterBindingDef *def)
virNWFilterBindingDef *
virNWFilterBindingDefCopy(virNWFilterBindingDef *src)
{
virNWFilterBindingDef *ret;
ret = g_new0(virNWFilterBindingDef, 1);
g_autoptr(virNWFilterBindingDef) ret = g_new0(virNWFilterBindingDef, 1);
ret->ownername = g_strdup(src->ownername);
@ -70,10 +68,9 @@ virNWFilterBindingDefCopy(virNWFilterBindingDef *src)
if (virNWFilterHashTablePutAll(src->filterparams, ret->filterparams) < 0)
goto error;
return ret;
return g_steal_pointer(&ret);
error:
virNWFilterBindingDefFree(ret);
return NULL;
}