提交 fdf14d46 编写于 作者: S Sukrit Bhatnagar 提交者: Erik Skultety

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: NSukrit Bhatnagar <skrtbhtngr@gmail.com>
Reviewed-by: NErik Skultety <eskultet@redhat.com>
上级 b7ef069e
......@@ -1181,9 +1181,9 @@ int virNetDevMacVLanDeleteWithVPortProfile(const char *ifname,
}
if (mode == VIR_NETDEV_MACVLAN_MODE_PASSTHRU) {
virMacAddrPtr MAC = NULL;
virMacAddrPtr adminMAC = NULL;
virNetDevVlanPtr vlan = NULL;
VIR_AUTOPTR(virMacAddr) MAC = NULL;
VIR_AUTOPTR(virMacAddr) adminMAC = NULL;
VIR_AUTOPTR(virNetDevVlan) vlan = NULL;
if ((virNetDevReadNetConfig(linkdev, -1, stateDir,
&adminMAC, &vlan, &MAC) == 0) &&
......@@ -1191,9 +1191,6 @@ int virNetDevMacVLanDeleteWithVPortProfile(const char *ifname,
ignore_value(virNetDevSetNetConfig(linkdev, -1,
adminMAC, vlan, MAC, !!vlan));
VIR_FREE(MAC);
VIR_FREE(adminMAC);
virNetDevVlanFree(vlan);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册