Skip to content

Commit

Permalink
Fix memory leak in egg_string_unicodesup_desurrogate()
Browse files Browse the repository at this point in the history
Patch by: michaelortmann
  • Loading branch information
michaelortmann authored Jun 2, 2024
1 parent 39a582c commit 9068233
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/tcl.c
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,7 @@ Tcl_Obj *egg_string_unicodesup_desurrogate(const char *oldstr, int len)
{
int stridx = 0, bufidx = 0;
char *buf = nmalloc(len);
Tcl_Obj *o;

while (stridx < len) {
uint32_t low, high;
Expand All @@ -787,7 +788,10 @@ Tcl_Obj *egg_string_unicodesup_desurrogate(const char *oldstr, int len)
}
}
}
return Tcl_NewStringObj(buf, bufidx);

o = Tcl_NewStringObj(buf, bufidx);
nfree(buf);
return o;
}

/* C function called for ::egg_tcl_tolower/toupper/totitle
Expand Down

0 comments on commit 9068233

Please sign in to comment.