Skip to content

Make expand_ipv6 use caller-provided buffer#17

Merged
Essency merged 1 commit intoazzurra:masterfrom
rfc1459:features/fix-ipv6-memleak
Apr 27, 2026
Merged

Make expand_ipv6 use caller-provided buffer#17
Essency merged 1 commit intoazzurra:masterfrom
rfc1459:features/fix-ipv6-memleak

Conversation

@rfc1459
Copy link
Copy Markdown
Contributor

@rfc1459 rfc1459 commented Apr 27, 2026

The memory management semantics of expand_ipv6() weren't specified explicitly, so callers never bothered with free()'ing its return value.

This caused the IPv6 clone checker to leak memory like a sieve because the expand_ipv6() function would be called in a hot loop iterating over every single IPv6 client.

Fix this ugly behavior by getting rid of dynamic memory allocation altogether and making expand_ipv6 take a caller-provided buffer to perform its work (some callers were copying its return value to an already existing buffer anyway...).

The memory management semantics of expand_ipv6() weren't specified
explicitly, so callers never bothered with free()'ing its return value.

This caused the IPv6 clone checker to leak memory like a sieve because
the expand_ipv6() function would be called in a hot loop iterating over
*every single IPv6 client*.

Fix this ugly behavior by getting rid of dynamic memory allocation
altogether and making expand_ipv6 take a caller-provided buffer to
perform its work (some callers were copying its return value to an
already existing buffer anyway...).
@rfc1459 rfc1459 requested a review from a team April 27, 2026 18:11
@Essency Essency merged commit 57ed321 into azzurra:master Apr 27, 2026
4 checks passed
@rfc1459 rfc1459 deleted the features/fix-ipv6-memleak branch April 27, 2026 21:26
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.

3 participants