summaryrefslogtreecommitdiff
path: root/sbin/ifconfig/ifconfig.c
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2005-10-10 10:28:20 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2005-10-10 10:28:20 +0000
commit2cdb7ee5c389c942a499d13f040e26c189aacccd (patch)
tree5ac892887d87a063b4f69904e165234e120d486e /sbin/ifconfig/ifconfig.c
parent00974e557c90be2803e42e20cb21d95d555a06d1 (diff)
getifaddrs() slightly later in printif(), prevents possible memleak
Andrey Matveev <evol@online.ptt.ru>
Diffstat (limited to 'sbin/ifconfig/ifconfig.c')
-rw-r--r--sbin/ifconfig/ifconfig.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c
index 2b399ce924d..468fa41b521 100644
--- a/sbin/ifconfig/ifconfig.c
+++ b/sbin/ifconfig/ifconfig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ifconfig.c,v 1.150 2005/10/03 01:35:12 reyk Exp $ */
+/* $OpenBSD: ifconfig.c,v 1.151 2005/10/10 10:28:19 henning Exp $ */
/* $NetBSD: ifconfig.c,v 1.40 1997/10/01 02:19:43 enami Exp $ */
/*
@@ -708,9 +708,6 @@ printif(char *ifname, int ifaliases)
struct ifreq *ifrp;
int nlen = 0, count = 0, noinet = 1;
- if (getifaddrs(&ifap) != 0)
- err(1, "getifaddrs");
-
if (ifname) {
if ((oname = strdup(ifname)) == NULL)
err(1, "strdup");
@@ -720,6 +717,9 @@ printif(char *ifname, int ifaliases)
return;
}
+ if (getifaddrs(&ifap) != 0)
+ err(1, "getifaddrs");
+
namep = NULL;
for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
if (oname) {