[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
PATCH [3/5]: mkinitrd: fix multiple memleaks in network handling code
- From: Hans de Goede <hdegoede redhat com>
- To: Discussion of Development and Customization of the Red Hat Linux Installer <anaconda-devel-list redhat com>
- Subject: PATCH [3/5]: mkinitrd: fix multiple memleaks in network handling code
- Date: Sun, 01 Feb 2009 15:12:52 +0100
Hi all,
This patch fixes multiple memleaks in the network handling code.
Regards,
Hans
diff -up mkinitrd-6.0.75/nash/network.c.leak mkinitrd-6.0.75/nash/network.c
--- mkinitrd-6.0.75/nash/network.c.leak 2009-01-31 13:06:38.000000000 +0100
+++ mkinitrd-6.0.75/nash/network.c 2009-01-31 13:13:01.000000000 +0100
@@ -149,6 +149,7 @@ static int nashSetMTU(char * dev, int mt
struct nl_cache *cache = NULL;
struct rtnl_link *link = NULL;
struct rtnl_link *request = NULL;
+ int ret;
if (dev == NULL || mtu <= 0)
return 1;
@@ -168,6 +169,7 @@ static int nashSetMTU(char * dev, int mt
}
if ((link = rtnl_link_get_by_name(cache, dev)) == NULL) {
+ nl_cache_free(cache);
nl_close(handle);
nl_handle_destroy(handle);
return 1;
@@ -176,14 +178,15 @@ static int nashSetMTU(char * dev, int mt
request = rtnl_link_alloc();
rtnl_link_set_mtu(request, mtu);
- if (rtnl_link_change(handle, link, request, 0)) {
- rtnl_link_put(link);
- nl_close(handle);
- nl_handle_destroy(handle);
- return 1;
- }
+ ret = rtnl_link_change(handle, link, request, 0);
- return 0;
+ rtnl_link_put(link);
+ rtnl_link_put(request);
+ nl_cache_free(cache);
+ nl_close(handle);
+ nl_handle_destroy(handle);
+
+ return ret;
}
static char *dhclientLeaseLineParse(char *linebuf, char *key) {
@@ -322,6 +325,7 @@ static char *nashSetupInterface(char *de
}
/* success */
+ nl_cache_free(cache);
nl_close(handle);
nl_handle_destroy(handle);
return NULL;
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]