From 74349dcdc3b1d6d7be1231dca5f5d649f4c0c6fb Mon Sep 17 00:00:00 2001 From: Thomas Graf Date: Fri, 9 Sep 2011 11:39:09 +0200 Subject: [PATCH] core: Fix leaks if address parsing fails while setting mac Both 'old' and 'new' are leaked if nl_addr_build() fails to parse the mac address. --- src/nm-system.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/nm-system.c b/src/nm-system.c index 7fa4b6a4de..0b294684e1 100644 --- a/src/nm-system.c +++ b/src/nm-system.c @@ -755,6 +755,8 @@ nm_system_iface_set_mac (int ifindex, const struct ether_addr *mac) addr = nl_addr_build (AF_LLC, (void *) mac, ETH_ALEN); if (!addr) { nm_log_err (LOGD_HW, "(%s): failed to allocate memory for MAC address change", iface); + rtnl_link_put (old); + rtnl_link_put (new); return FALSE; } rtnl_link_set_addr (new, addr);