Page MenuHomeFreeBSD

libpfctl: fix memory leak
ClosedPublic

Authored by kp on May 27 2021, 9:48 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Sep 19, 3:41 PM
Unknown Object (File)
Wed, Sep 6, 5:51 AM
Unknown Object (File)
Aug 16 2023, 8:54 AM
Unknown Object (File)
Aug 16 2023, 7:31 AM
Unknown Object (File)
Aug 13 2023, 12:29 AM
Unknown Object (File)
Jul 12 2023, 5:03 PM
Unknown Object (File)
Apr 3 2023, 6:32 AM
Unknown Object (File)
Mar 24 2023, 5:38 PM
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.