Skip to content

cpnet, VMInetAddress: fix memory leaks on error paths - #81

Merged
guillerodriguez merged 1 commit into
fix/cpnet-freeaddresses-array-leakfrom
fix/cpnet-error-path-leaks
Nov 3, 2026
Merged

guillerodriguez merged 1 commit into
fix/cpnet-freeaddresses-array-leakfrom
fix/cpnet-error-path-leaks

Conversation

@guillerodriguez

Copy link
Copy Markdown
Contributor
  • VMInetAddress: getHostByName(): release the host name string when the lookup fails; free the addresses when the Java array cannot be built.
  • VMInetAddress: getHostByAddr(): when a 16 byte address was passed in a build without IPv6 support, the address bytes were leaked. Fix this by rejecting the address before retrieving the bytes.
  • cpnet_getMulticastIF(): free the address when getsockopt() fails.

- VMInetAddress: getHostByName(): release the host name string when
  the lookup fails; free the addresses when the Java array cannot
  be built.
- VMInetAddress: getHostByAddr(): when a 16 byte address was passed
  in a build without IPv6 support, the address bytes were leaked.
  Fix this by rejecting the address before retrieving the bytes.
- cpnet_getMulticastIF(): free the address when getsockopt() fails.

Signed-off-by: Guillermo Rodríguez <grodriguez@ingelabs.com>
@guillerodriguez
guillerodriguez merged commit 121d539 into master Nov 3, 2026
3 checks passed
@guillerodriguez
guillerodriguez deleted the fix/cpnet-error-path-leaks 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