Skip to content

cpnet: also free the array when freeing an array of addresses - #80

Merged
guillerodriguez merged 1 commit into
masterfrom
fix/cpnet-freeaddresses-array-leak
Nov 3, 2026
Merged

guillerodriguez merged 1 commit into
masterfrom
fix/cpnet-freeaddresses-array-leak

Conversation

@guillerodriguez

Copy link
Copy Markdown
Contributor

cpnet_freeAddresses() freed each address in the supplied array, but not the array itself. The error path in cpnet_getHostByName() did free the array, but none of the callers in VMInetAddress did, so every successful host name lookup leaked the array.

Rename the function to cpnet_freeAddressArray() and have it free the array too. The new name makes the intent clear, which should help avoiding this kind of leaks in the future.

cpnet_freeAddresses() freed each address in the supplied array,
but not the array itself. The error path in cpnet_getHostByName()
did free the array, but none of the callers in VMInetAddress did,
so every successful host name lookup leaked the array.

Rename the function to cpnet_freeAddressArray() and have it free
the array too. The new name makes the intent clear, which should
help avoiding this kind of leaks in the future.

Signed-off-by: Guillermo Rodríguez <grodriguez@ingelabs.com>
@guillerodriguez
guillerodriguez merged commit 80587dd into master Nov 3, 2026
3 checks passed
@guillerodriguez
guillerodriguez deleted the fix/cpnet-freeaddresses-array-leak branch November 3, 2026 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants