Page MenuHomeFreeBSD

libpfctl: fix memory leak
ClosedPublic

Authored by kp on May 27 2021, 9:48 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Feb 8, 4:08 AM
Unknown Object (File)
Mon, Jan 27, 8:03 PM
Unknown Object (File)
Sun, Jan 26, 8:37 PM
Unknown Object (File)
Sat, Jan 18, 10:13 PM
Unknown Object (File)
Sat, Jan 18, 10:06 PM
Unknown Object (File)
Jan 11 2025, 6:07 PM
Unknown Object (File)
Jan 10 2025, 9:50 AM
Unknown Object (File)
Jan 10 2025, 3:43 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.