Skip to content

Fix leak of resolved address list in snmp_session_init()#91

Closed
iliaal wants to merge 2 commits into
PHP-8.4from
fix-snmp-resolver-leak
Closed

Fix leak of resolved address list in snmp_session_init()#91
iliaal wants to merge 2 commits into
PHP-8.4from
fix-snmp-resolver-leak

Conversation

@iliaal

@iliaal iliaal commented Jun 16, 2026

Copy link
Copy Markdown
Owner

When php_network_getaddresses() succeeds but no resolved address yields a usable peer name (for example bracketed IPv6 syntax over an IPv4-only host), snmp_session_init() returned without php_network_freeaddresses(), leaking the address list on every such call. Free it on that error path, matching the success path and the convention in main/network.c.

@iliaal iliaal force-pushed the fix-snmp-resolver-leak branch from afb7c04 to 08ca414 Compare June 16, 2026 20:00
@iliaal iliaal force-pushed the fix-snmp-resolver-leak branch from 08ca414 to 23f2a25 Compare June 16, 2026 21:20
When php_network_getaddresses() succeeds but none of the resolved
addresses yield a usable peer name (for example bracketed IPv6 syntax
over an IPv4-only host), snmp_session_init() returned without calling
php_network_freeaddresses(), leaking the address list on every such call.
Free it on that error path as the success path already does.

Closes phpGH-22340
@iliaal iliaal force-pushed the fix-snmp-resolver-leak branch from 23f2a25 to a33d77f Compare June 16, 2026 21:21
@iliaal

iliaal commented Jun 16, 2026

Copy link
Copy Markdown
Owner Author

Submitted upstream as php#22340.

@iliaal iliaal closed this Jun 16, 2026
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