Skip to content

fix: GameData handle leak in OnPluginStart's ClientPrint detour setup - #48

Merged
Rushaway merged 2 commits into
masterfrom
fix/gamedata-handle-leak
Sep 21, 2026
Merged

Rushaway merged 2 commits into
masterfrom
fix/gamedata-handle-leak

Conversation

@Rushaway

Copy link
Copy Markdown
Member

Summary

  • The GameData handle used to set up the ClientPrint detour was only freed on the "offset not found" error path; the success path fell through to the end of OnPluginStart without closing it.
  • Added delete gd; after the detour setup completes.

Fixes #47.

Test plan

  • Compiled cleanly with the local SourcePawn compiler (no new errors/warnings — the pre-existing kv shadowing warnings from shared includes are unrelated to this change).

🤖 Generated with Claude Code

The GameData handle created to set up the ClientPrint detour was only
closed on the "failed to find ClientPrint offset" error path; the
success path (detour created, whether or not DHookEnableDetour itself
succeeds) fell through to the end of OnPluginStart without ever
freeing it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings September 20, 2026 13:11

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.

Copilot review overview

🟢 Approval recommended

The handle is now cleaned up on the successful setup path, with existing failure cleanup preserved.

Review effort: Lite
Findings: None

What changed in this PR

Fixes a GameData handle leak during ClientPrint detour setup.

Changes:

  • Releases gd after successful detour initialization.
  • Preserves cleanup on failure paths.
File Description
addons/​sourcemod/​scripting/​ConsoleChatManager.sp Releases the GameData handle after detour setup.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@Rushaway
Rushaway merged commit a9c57c1 into master Sep 21, 2026
6 checks passed
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.

GameData handle leaked in OnPluginStart's ClientPrint detour setup

2 participants