mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-14 14:55:41 +00:00
Guard against use-after-free after calling mibif_free(..)
Set variables to NULL after calling free. Also, remove unnecessary if (x != NULL) checks before calling free(x) MFC after: 1 week
This commit is contained in:
parent
d481a92572
commit
8373993535
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=310873
@ -707,10 +707,11 @@ mibif_free(struct mibif *ifp)
|
||||
}
|
||||
|
||||
free(ifp->private);
|
||||
if (ifp->physaddr != NULL)
|
||||
free(ifp->physaddr);
|
||||
if (ifp->specmib != NULL)
|
||||
free(ifp->specmib);
|
||||
ifp->private = NULL;
|
||||
free(ifp->physaddr);
|
||||
ifp->physaddr = NULL;
|
||||
free(ifp->specmib);
|
||||
ifp->specmib = NULL;
|
||||
|
||||
STAILQ_FOREACH(map, &mibindexmap_list, link)
|
||||
if (map->mibif == ifp) {
|
||||
@ -745,8 +746,8 @@ mibif_free(struct mibif *ifp)
|
||||
at = at1;
|
||||
}
|
||||
|
||||
|
||||
free(ifp);
|
||||
ifp = NULL;
|
||||
mib_if_number--;
|
||||
mib_iftable_last_change = this_tick;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user