summaryrefslogtreecommitdiffstats
path: root/usr.sbin/route6d
diff options
context:
space:
mode:
authorcem <cem@FreeBSD.org>2016-05-11 22:33:20 +0000
committercem <cem@FreeBSD.org>2016-05-11 22:33:20 +0000
commit3fa2461dded81ad3fca79f6343f24cc5d7e307c1 (patch)
tree84d30b4fc55ee5d0e7895447b07eb671119e7731 /usr.sbin/route6d
parent4c080eaa62947a515fc872f7666267fcacf16ea7 (diff)
downloadFreeBSD-src-3fa2461dded81ad3fca79f6343f24cc5d7e307c1.zip
FreeBSD-src-3fa2461dded81ad3fca79f6343f24cc5d7e307c1.tar.gz
route6d(8): Fix potential double-free
In the case that the subsequent sysctl(3) call failed, 'buf' could be free(3)ed repeatedly. It isn't clear to me that that case is possible, but be clear and do the right thing in case it is. Reported by: Coverity CID: 272537 Sponsored by: EMC / Isilon Storage Division
Diffstat (limited to 'usr.sbin/route6d')
-rw-r--r--usr.sbin/route6d/route6d.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.sbin/route6d/route6d.c b/usr.sbin/route6d/route6d.c
index 3c3d9d3..91c1d37 100644
--- a/usr.sbin/route6d/route6d.c
+++ b/usr.sbin/route6d/route6d.c
@@ -2598,8 +2598,10 @@ krtread(int again)
sleep(1);
retry++;
errmsg = NULL;
- if (buf)
+ if (buf) {
free(buf);
+ buf = NULL;
+ }
if (sysctl(mib, 6, NULL, &msize, NULL, 0) < 0) {
errmsg = "sysctl estimate";
continue;
OpenPOWER on IntegriCloud