Page MenuHomeFreeBSD

Fix a memory leak in ipfw
ClosedPublic

Authored by trix_juniper.net on Mar 11 2017, 4:38 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Nov 15, 7:12 PM
Unknown Object (File)
Thu, Nov 14, 6:01 AM
Unknown Object (File)
Mon, Nov 11, 1:50 AM
Unknown Object (File)
Sun, Nov 10, 9:41 AM
Unknown Object (File)
Oct 4 2024, 12:40 AM
Unknown Object (File)
Oct 3 2024, 5:47 PM
Unknown Object (File)
Oct 3 2024, 8:30 AM
Unknown Object (File)
Oct 2 2024, 9:16 PM
Subscribers

Details

Summary

ipv6.c fill_ip6
The value of the pointer av changes before it is freed.
Introduce a new variable, lav, to track the original value.

Test Plan

Use clang's static analyzer, scan-build, to find the problem and later to show resolution.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Looks good to me. There's just one minor nit, though; in get_mac_addr_mask()::ipfw2.c
there's already precedence for using 'o' rather than 'l' (as in "local"?) as prefix for the
variable holding the original pointer returned by strdup(3). It would be great to stay
consistent across ipfw(8) in this regard.
If I'm not mistaken, you don't have a src commit bit. Shall I commit the change on
behalf of you?

This revision is now accepted and ready to land.Mar 12 2017, 4:17 PM

No commit bit.
Yes, l as in local, there have been similar problems where the pointer
variable is a passed in parameter.
Let me do the o change first, I¹ll take take of that tomorrow.
Tom

I think it would be better move all local variables to the top of function according to style(9) and reuse some already existing variable for this.

trix_juniper.net edited edge metadata.

change 'lav' to 'oav'

This revision now requires review to proceed.Mar 13 2017, 3:48 PM
This revision was automatically updated to reflect the committed changes.