HomeFreeBSD

systat: Fix a bunch of use after frees in fetch_ifstat().

Description

systat: Fix a bunch of use after frees in fetch_ifstat().

I think this was probably just a typo. initifstat() continues around
a similar loop if the mib data fails to fetch, and fetch_ifstat() was
already using a FOREACH_SAFE loop here so expected to keep going.
Calling clearifstat() from the fetch routine also seems wrong, and the
sort_interface_list() call triggered by the existing needsort = 1 will
itself set needclear to trigger a future clearifstat().

Reported by: GCC 12 -Wuse-after-free
Differential Revision: https://reviews.freebsd.org/D36823

Details

Provenance
jhbAuthored on Nov 22 2022, 7:11 PM
Differential Revision
D36823: systat: Fix a bunch of use after frees in fetch_ifstat().
Parents
rGbee60c989745: iwlwifi: fix hang on unloading driver
Branches
Unknown
Tags
Unknown