Skip to content

Commit 8ce7515

Browse files
authored
Merge pull request #7975 from QuantamHD/fix_false_positive_mem_leak
utl: Fixes memory leak false positive with Google heap checker
2 parents a4390e1 + da22765 commit 8ce7515

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/utl/src/decode.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,15 @@ std::string base64_decode(const char* encoded_strings[])
116116
void evalTclInit(Tcl_Interp* interp, const char* inits[])
117117
{
118118
std::string unencoded = base64_decode(inits);
119-
if (Tcl_Eval(interp, unencoded.c_str()) != TCL_OK) {
119+
Tcl_Obj* obj = Tcl_NewStringObj(unencoded.c_str(), unencoded.size());
120+
Tcl_IncrRefCount(obj);
121+
if (Tcl_EvalObjEx(interp, obj, 0) != TCL_OK) {
120122
Tcl_Eval(interp, "$errorInfo");
121123
const char* tcl_err = Tcl_GetStringResult(interp);
122124
fprintf(stderr, "Error: TCL init script: %s.\n", tcl_err);
123125
exit(1);
124126
}
127+
Tcl_DecrRefCount(obj);
125128
}
126129

127130
} // namespace utl

0 commit comments

Comments
 (0)