mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 12:35:17 +00:00
util: netdevmacvlan: use VIR_AUTOPTR for aggregate types
By making use of GNU C's cleanup attribute handled by the VIR_AUTOPTR macro for declaring aggregate pointer variables, majority of the calls to *Free functions can be dropped, which in turn leads to getting rid of most of our cleanup sections. Signed-off-by: Sukrit Bhatnagar <skrtbhtngr@gmail.com> Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
b7ef069ec7
commit
fdf14d4698
@ -1181,9 +1181,9 @@ int virNetDevMacVLanDeleteWithVPortProfile(const char *ifname,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mode == VIR_NETDEV_MACVLAN_MODE_PASSTHRU) {
|
if (mode == VIR_NETDEV_MACVLAN_MODE_PASSTHRU) {
|
||||||
virMacAddrPtr MAC = NULL;
|
VIR_AUTOPTR(virMacAddr) MAC = NULL;
|
||||||
virMacAddrPtr adminMAC = NULL;
|
VIR_AUTOPTR(virMacAddr) adminMAC = NULL;
|
||||||
virNetDevVlanPtr vlan = NULL;
|
VIR_AUTOPTR(virNetDevVlan) vlan = NULL;
|
||||||
|
|
||||||
if ((virNetDevReadNetConfig(linkdev, -1, stateDir,
|
if ((virNetDevReadNetConfig(linkdev, -1, stateDir,
|
||||||
&adminMAC, &vlan, &MAC) == 0) &&
|
&adminMAC, &vlan, &MAC) == 0) &&
|
||||||
@ -1191,9 +1191,6 @@ int virNetDevMacVLanDeleteWithVPortProfile(const char *ifname,
|
|||||||
|
|
||||||
ignore_value(virNetDevSetNetConfig(linkdev, -1,
|
ignore_value(virNetDevSetNetConfig(linkdev, -1,
|
||||||
adminMAC, vlan, MAC, !!vlan));
|
adminMAC, vlan, MAC, !!vlan));
|
||||||
VIR_FREE(MAC);
|
|
||||||
VIR_FREE(adminMAC);
|
|
||||||
virNetDevVlanFree(vlan);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user