rtsold: Fix a buffer leak if we fail to read the default router sysctl
MFC after: 1 week Reported by: Kevin Day <kevin@your.org>
This commit is contained in:
@@ -151,8 +151,10 @@ probe_defrouters(uint32_t ifindex, uint32_t linkid)
|
||||
buf = malloc(len);
|
||||
if (buf == NULL)
|
||||
return (-1);
|
||||
if (sysctl(mib, nitems(mib), buf, &len, NULL, 0) < 0)
|
||||
if (sysctl(mib, nitems(mib), buf, &len, NULL, 0) < 0) {
|
||||
free(buf);
|
||||
return (-1);
|
||||
}
|
||||
ep = (struct in6_defrouter *)(void *)(buf + len);
|
||||
for (p = (struct in6_defrouter *)(void *)buf; p < ep; p++) {
|
||||
if (ifindex != p->if_index)
|
||||
|
||||
Reference in New Issue
Block a user