If a route is modified in a way that changes the route's source
address (i.e. the address used to access the gateway), then a
reference on the ifaddr representing the old source address will
be leaked if the address type does not have an ifa_rtrequest
method defined. Plug the leak by releasing the reference in
all cases.
Details
Details
- Reviewers
ae - Commits
- rS326860: Plug an ifaddr leak when changing a route's src
I wrote this script to demonstrate the bug:
https://people.freebsd.org/~rstone/route-change-leak
On a stock -head system, I see the number of allocated entries in the ifaddr malloc type go up 100 every time I execute the script. With the fix, the number of allocated entries remains stable as expected.
Diff Detail
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Comment Actions
It would be nice if you describe why this leak happens, i.e. where leaked reference was acquired.
Comment Actions
From quick look, it seems ifa_rtrequest does not release this reference and the change is correct.