Permalink
Browse files

trigger_bind() overallocation

  • Loading branch information...
michaelortmann authored and vanosg committed Oct 12, 2018
1 parent 91cc387 commit 2d1fcc41e82e5e592b85a3cbcd598f12462e23d0
Showing with 5 additions and 4 deletions.
  1. +5 −4 src/tclhash.c
View
@@ -715,17 +715,18 @@ static int trigger_bind(const char *proc, const char *param,
{
int x;
#ifdef DEBUG_CONTEXT
const char *msg = "Tcl proc: %s, param: %s";
#define FORMAT "Tcl proc: %s, param: %s"
char *buf;
/* We now try to debug the Tcl_VarEval() call below by remembering both
* the called proc name and it's parameters. This should render us a bit
* less helpless when we see context dumps.
*/
Context;
buf = nmalloc(strlen(msg) + (proc ? strlen(proc) : 6)
+ (param ? strlen(param) : 6) + 1);
sprintf(buf, msg, proc ? proc : "<null>", param ? param : "<null>");
/* reuse x */
x = snprintf(NULL, 0, FORMAT, proc ? proc : "<null>", param ? param : "<null>");
buf = nmalloc(x + 1);
sprintf(buf, FORMAT, proc ? proc : "<null>", param ? param : "<null>");
ContextNote(buf);
nfree(buf);
#endif /* DEBUG_CONTEXT */

0 comments on commit 2d1fcc4

Please sign in to comment.