diff --git a/tcl.c b/tcl.c index b989c3c..909bea2 100644 --- a/tcl.c +++ b/tcl.c @@ -587,7 +587,7 @@ void tcl_destroy(struct tcl* tcl) { struct tcl_cmd* cmd = tcl->cmds; tcl->cmds = tcl->cmds->next; tcl_free(cmd->name); - free(cmd->arg); + if (cmd->fn == tcl_user_proc && cmd->arg) { tcl_free((tcl_value_t*)cmd->arg); } free(cmd); } tcl_free(tcl->result);