Page MenuHomeFreeBSD

fix leak of the ifg_list structure in if_delgroups.
AbandonedPublic

Authored by jacob.e.keller_intel.com on Fri, Nov 1, 5:25 PM.

Details

Reviewers
jhb
gallatin
erj
Group Reviewers
Intel Networking
Summary

The ifg_list and ifg_member structures are allocated on M_TEMP in
if_addgroup. The ifg_list pointer is properly released in if_delgroup,
but not in if_delgroups.

Fix if_delgroups to release the ifgl pointer as well as the ifgm
pointer, so that we do not leak memory when detaching an interface.

An alternative fix might be to factor out logic for actually freeing the
group memory into a separate function.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>

Diff Detail

Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 27308
Build 25566: arc lint + arc unit

Event Timeline

This is the simpler straight forward fix to the same issue described in https://reviews.freebsd.org/D22214

Also, yay.. yet another memory leak fixed while playing whack-a-mole trying to fix leaks during driver load/unload testing. I think we still have at least one more on M_IFADDR somewhere.

jhb added a comment.Fri, Nov 1, 6:09 PM

I think the refactored version to avoid code duplication is probably a better fix. If you go with this one, perhaps remove the whitespace changes and only commit the added free().

I think the refactored version to avoid code duplication is probably a better fix. If you go with this one, perhaps remove the whitespace changes and only commit the added free().

Lets just go with the refactor, after adding a lock assert.

We're in agreement that the refactor is a better solution, so I'm going to abandon this one.