Repository navigation
fix: GameData handle leak in OnPluginStart's ClientPrint detour setup - #48
Merged
Merged
Conversation
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>
There was a problem hiding this comment.
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
gdafter 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
GameDatahandle used to set up theClientPrintdetour was only freed on the "offset not found" error path; the success path fell through to the end ofOnPluginStartwithout closing it.delete gd;after the detour setup completes.Fixes #47.
Test plan
kvshadowing warnings from shared includes are unrelated to this change).🤖 Generated with Claude Code