Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2022-08-23
10:22
small amend to [d052d2a1b01ba2c8], code review check-in: 545b86c21d user: sebres tags: trunk, main
07:06 • Ticket [d052d2a1b0] avoid leak in TestsetbytearraylengthObjCmd() status stil... artifact: d780c62782 user: jan.nijtmans
07:06 • Closed ticket [d052d2a1b0]. artifact: 8eb8082eff user: jan.nijtmans
07:03
Fix [d052d2a1b01ba2c8]: avoid leak in TestsetbytearraylengthObjCmd() check-in: 28c9825590 user: jan.nijtmans tags: trunk, main
2022-08-20
14:21 • New ticket [d052d2a1b0] avoid leak in TestsetbytearraylengthObjCmd(). artifact: abd74bb92d user: chrstphrchvz

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.