Page MenuHomeFreeBSD

libpfctl: fix memory leak
ClosedPublic

Authored by kp on May 27 2021, 9:48 AM.
Tags
None
Referenced Files
Unknown Object (File)
Nov 22 2024, 10:46 AM
Unknown Object (File)
Nov 13 2024, 10:45 PM
Unknown Object (File)
Nov 11 2024, 9:19 PM
Unknown Object (File)
Oct 20 2024, 11:09 PM
Unknown Object (File)
Oct 17 2024, 5:28 AM
Unknown Object (File)
Oct 17 2024, 5:06 AM
Unknown Object (File)
Oct 1 2024, 4:21 PM
Unknown Object (File)
Oct 1 2024, 4:13 AM
Subscribers

Details

Summary

When we create an nvlist and insert it into another nvlist we must
remember to destroy it. The nvlist_add_nvlist() function makes a copy,
just like nvlist_add_string() makes a copy of the string.

See also 4483fb47735c29408c72045469c9c4b3e549668b

MFC after: 3 days
Sponsored by: Rubicon Communications, LLC ("Netgate")

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kp requested review of this revision.May 27 2021, 9:48 AM
scottl added a subscriber: scottl.

This looks like a deficiency in the API design, but I don't object to this change.

This revision is now accepted and ready to land.May 28 2021, 7:14 PM

This looks like a deficiency in the API design, but I don't object to this change.

You mean the nvlist API? Not really. This one is on me.
The API is consistent in copying data that's added to an nvlist with nvlist_add_*(). It does it with strings, and it also does it with nvlists. It does make sense, but I'd not thought of that when I originally wrote this code.

This revision was automatically updated to reflect the committed changes.