Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: abd74bb92d1e1b9f151d16d67d16681855e78fabe11a9db4735c0f90f24b7806
Ticket: d052d2a1b01ba2c8f89397810d7e03c01da08ff1
avoid leak in TestsetbytearraylengthObjCmd()
User & Date: chrstphrchvz on 2022-08-20 14:21:34
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/x-markdown"
  4. comment changed to:
    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:
    
    <pre>
    --- generic/tclTest.c.orig
    +++ generic/tclTest.c
    @@ -5130,6 +5130,9 @@
     	obj = objv[1];
         }
         if (NULL == Tcl_SetByteArrayLength(obj, n)) {
    <span style="color:green">+	if (Tcl_IsShared(objv[1])) {
    +	    Tcl_DecrRefCount(obj);
    +	}</span>
     	Tcl_SetResult(interp, "expected bytes", TCL_STATIC);
     	return TCL_ERROR;
         }
    <pre>
    
  5. foundin changed to: "trunk"
  6. is_private changed to: "0"
  7. login: "chrstphrchvz"
  8. priority changed to: "5 Medium"
  9. resolution changed to: "None"
  10. severity changed to: "Cosmetic"
  11. status changed to: "Open"
  12. submitter changed to: "chrstphrchvz"
  13. subsystem changed to: "12. ByteArray Object"
  14. title changed to: "avoid leak in TestsetbytearraylengthObjCmd()"
  15. type changed to: "Patch"