commit | 6f13e538868b0c5ecb49cf87559740d3e65f68bf | [log] [tgz] |
---|---|---|
author | Simon Kelley <simon@thekelleys.org.uk> | Tue Apr 17 14:25:06 2012 +0100 |
committer | Simon Kelley <simon@thekelleys.org.uk> | Tue Apr 17 14:25:06 2012 +0100 |
tree | 417ad2deb140b27a8f22d6cae3d3f7423fbf36f1 | |
parent | d1c759c5c13d18a27de51d9a1c6475df4ba47a08 [diff] [blame] |
Tidy up malloc-failure handling.
diff --git a/src/network.c b/src/network.c index b997b48..8ee9907 100644 --- a/src/network.c +++ b/src/network.c
@@ -266,10 +266,13 @@ iface->dad = dad; iface->done = 0; if ((iface->name = whine_malloc(strlen(ifr.ifr_name)+1))) - strcpy(iface->name, ifr.ifr_name); - iface->next = *irecp; - *irecp = iface; - return 1; + { + strcpy(iface->name, ifr.ifr_name); + iface->next = *irecp; + *irecp = iface; + return 1; + } + free(iface); } errno = ENOMEM;