summaryrefslogtreecommitdiffstats
path: root/usr.sbin/route6d
diff options
context:
space:
mode:
authorbluhm <bluhm@openbsd.org>2015-02-04 20:16:23 +0000
committerbluhm <bluhm@openbsd.org>2015-02-04 20:16:23 +0000
commit974be262c07b063ea2549711d80c745ad865a37a (patch)
tree7b5aa66f74e674d285c4ce899ef0748f6deadf07 /usr.sbin/route6d
parentimprove diagnostics regarding arguments of .An .Pp .Lp .br .sp (diff)
downloadwireguard-openbsd-974be262c07b063ea2549711d80c745ad865a37a.tar.xz
wireguard-openbsd-974be262c07b063ea2549711d80c745ad865a37a.zip
Fix potentional double free in do-while-loop.
Found by Benjamin Baier with llvm/scan-build; OK florian@
Diffstat (limited to 'usr.sbin/route6d')
-rw-r--r--usr.sbin/route6d/route6d.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.sbin/route6d/route6d.c b/usr.sbin/route6d/route6d.c
index faecab21631..d2bc8dd2415 100644
--- a/usr.sbin/route6d/route6d.c
+++ b/usr.sbin/route6d/route6d.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: route6d.c,v 1.64 2015/01/16 06:40:20 deraadt Exp $ */
+/* $OpenBSD: route6d.c,v 1.65 2015/02/04 20:16:23 bluhm Exp $ */
/* $KAME: route6d.c,v 1.111 2006/10/25 06:38:13 jinmei Exp $ */
/*
@@ -2449,9 +2449,9 @@ krtread(int again)
mib[5] = 0; /* No flags */
do {
retry++;
+ free(buf);
+ buf = NULL;
errmsg = NULL;
- if (buf)
- free(buf);
if (sysctl(mib, 6, NULL, &msize, NULL, 0) < 0) {
errmsg = "sysctl estimate";
continue;