avoid leak in TestsetbytearraylengthObjCmd()
Closed / Fixedd052d2a1b01ba2c8f89397810d7e03c01da08ff1Created 4 years agoUpdated 4 years ago
Descriptionmarkdown2022-08-20 14:21:34
If TestsetbytearraylengthObjCmd() is called with a shared value and Tcl_SetByteArrayLength() returns NULL, then the duplicated value returned by Tcl_DuplicateObj() should be freed, otherwise it will be leaked:
--- generic/tclTest.c.orig
+++ generic/tclTest.c
@@ -5130,6 +5130,9 @@
obj = objv[1];
}
if (NULL == Tcl_SetByteArrayLength(obj, n)) {
+ if (Tcl_IsShared(objv[1])) {
- Tcl_DecrRefCount(obj);
- }
Tcl_SetResult(interp, "expected bytes", TCL_STATIC);
return TCL_ERROR;
}
jan.nijtmanswiki2022-08-23 07:06:16
Fixed [here]
jan.nijtmanswiki2022-08-23 07:06:19
Fixed [here]
Log in (anonymous is fine) to add a comment.