Skip to content

fix memory issue: free cmd->arg in tcl_destroy only when the cmd is tcl_user_proc#19

Open
0riginaln0 wants to merge 2 commits into
zserge:masterfrom
0riginaln0:patch-1
Open

fix memory issue: free cmd->arg in tcl_destroy only when the cmd is tcl_user_proc#19
0riginaln0 wants to merge 2 commits into
zserge:masterfrom
0riginaln0:patch-1

Conversation

@0riginaln0
Copy link
Copy Markdown

The data of cmd->arg pointer is meant to be managed externally, so freeing it in tcl_destroy may cause unwanted results

fixes #18

@0riginaln0 0riginaln0 marked this pull request as draft May 16, 2026 17:38
@0riginaln0 0riginaln0 changed the title Fix memory issue: Do not free cmd->arg in tcl_destroy fix memory issue: don't free cmd->arg in tcl_destroy when the cmd is not tcl_user_proc May 16, 2026
@0riginaln0 0riginaln0 marked this pull request as ready for review May 16, 2026 17:50
@0riginaln0
Copy link
Copy Markdown
Author

0riginaln0 commented May 16, 2026

@zserge
I understood that previous version introduced memory leak, by ignoring freeing the cmd->arg.
Now it ignores freeing the cmd->arg only when the command is not the tcl_user_proc.

@0riginaln0 0riginaln0 changed the title fix memory issue: don't free cmd->arg in tcl_destroy when the cmd is not tcl_user_proc fix memory issue: free cmd->arg in tcl_destroy only when the cmd is tcl_user_proc May 18, 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.

Segfault during tcl_destroy() for native commands with non-nil arg

1 participant