Bug #15471
closedMemory leak in pfSense module function ``pfSense_get_ifaddrs()``
100%
Description
Moving this over from #15459 since it does not appear to be a problem in LCDProc but in the base system pfSense PHP module.
There is a memory leak in the pfSense module function pfSense_get_ifaddrs()
. The function appears to leak some memory in certain contexts, and sometimes more/less memory than others. It's still unclear how/why but here are a few things that we seem to have determined so far:
- The function leaks 56 bytes on most calls, which happens to be the size of the
ifaddrs
struct, though the only apparent allocation made on that structure is also freed at the end. - When run on some interfaces it leaks 112 bytes (2x56).
- When run on WireGuard interfaces it doesn't leak at all.
I checked some other similar functions and they did not appear to leak anything (e.g. pfSense_getall_interface_addresses()
does not leak) as far as I could tell.
While the amount of memory is small, the function gets run dozens/hundreds of times in certain code paths and since LCDProc runs indefinitely in a loop, it adds up significantly over time.
Related issues