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
This commit is contained in:
Conrad Meyer 2016-05-11 22:33:20 +00:00
parent fdaa5d1c07
commit 134fd583cb
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=299491

View file

@ -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;