summaryrefslogtreecommitdiff
path: root/sbin/dhclient
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2015-01-31 03:13:05 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2015-01-31 03:13:05 +0000
commitc6afa802b36b92a737767c7e4578d393ce3af43b (patch)
tree62a2bf1166c1d0fd20d8e1d14490e2a3d0885ddc /sbin/dhclient
parentc7599a57bdb9b25fbf5cfd6db879ed593c247d53 (diff)
Always free(buf) if errmsg is set while trying to flush routes.
Diffstat (limited to 'sbin/dhclient')
-rw-r--r--sbin/dhclient/kroute.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/sbin/dhclient/kroute.c b/sbin/dhclient/kroute.c
index 36def3e0876..e3e252944c2 100644
--- a/sbin/dhclient/kroute.c
+++ b/sbin/dhclient/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.69 2015/01/30 14:14:53 krw Exp $ */
+/* $OpenBSD: kroute.c,v 1.70 2015/01/31 03:13:04 krw Exp $ */
/*
* Copyright 2012 Kenneth R Westerback <krw@openbsd.org>
@@ -99,7 +99,6 @@ priv_flush_routes(struct imsg_flush_routes *imsg)
return;
}
if ((bufp = realloc(buf, needed)) == NULL) {
- free(buf);
errmsg = "routes buf realloc:";
break;
}
@@ -107,7 +106,6 @@ priv_flush_routes(struct imsg_flush_routes *imsg)
if (sysctl(mib, 7, buf, &needed, NULL, 0) == -1) {
if (errno == ENOMEM)
continue;
- free(buf);
errmsg = "sysctl retrieval of routes:";
break;
}
@@ -117,6 +115,7 @@ priv_flush_routes(struct imsg_flush_routes *imsg)
if (errmsg) {
warning("route cleanup failed - %s %s (msize=%zu)",
errmsg, strerror(errno), needed);
+ free(buf);
return;
}