diff options
author | ngie <ngie@FreeBSD.org> | 2016-06-10 14:40:41 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2016-06-10 14:40:41 +0000 |
commit | 83bbb03153bf972ad0e7905fe2e746b223a47c34 (patch) | |
tree | 6ac54a5a03d789fb770f1aba561931a017dd5ab9 | |
parent | e9925ba39840661daa4c89e67c6d3300fb1bd671 (diff) | |
download | FreeBSD-src-83bbb03153bf972ad0e7905fe2e746b223a47c34.zip FreeBSD-src-83bbb03153bf972ad0e7905fe2e746b223a47c34.tar.gz |
MFC r299491:
r299491 (by cem):
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.
CID: 272537
-rw-r--r-- | usr.sbin/route6d/route6d.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.sbin/route6d/route6d.c b/usr.sbin/route6d/route6d.c index 053d872..287a9b1 100644 --- a/usr.sbin/route6d/route6d.c +++ b/usr.sbin/route6d/route6d.c @@ -2602,8 +2602,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; |