Skip to content

transport: fix two memleaks on error paths in transport_fullpacket() - #2343

Closed
vszakats wants to merge 1 commit into
libssh2:masterfrom
vszakats:transport-memleaks
Closed

vszakats wants to merge 1 commit into
libssh2:masterfrom
vszakats:transport-memleaks

Conversation

@vszakats

Copy link
Copy Markdown
Member

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes two memory leaks in transport_fullpacket() (in the ETM decrypt path) by ensuring the packet payload buffer is freed when early-returning on specific error conditions.

Changes:

  • Free p->payload when decrypt_buffer allocation fails during ETM processing.
  • Free p->payload when the decrypted padding length sanity check fails (protocol error path).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@vszakats vszakats closed this in d69ee04 Jul 18, 2026
@vszakats
vszakats deleted the transport-memleaks branch July 18, 2026 16:13
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