Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2011-07-12
19:34 • Closed ticket [3363369fff]: Tcl_SetObjResult can't handle NULL, despite docu... artifact: a73726bfc0 user: msofer
2011-07-11
19:29 • New ticket [3363369fff]. artifact: 02454db174 user: foomench

Tcl_SetObjResult can't handle NULL, despite documentation

Closed / Duplicate3363369fffffffffffffffffffffffffffffffffCreated 15 years agoUpdated 15 years ago
Descriptionplain2011-07-11 19:29:10
Documentation for Tcl_SetObjResult states, "If objPtr is NULL, interp->objResult is set to a new Tcl object containing an empty string." However, the code doesn't do this. In fact, it tries to use objPtr in a Tcl_IncrRefCount call without checking for NULL, which results in an exception. Here's the code:

void
Tcl_SetObjResult(
    Tcl_Interp *interp,/* Interpreter with which to associate the
 * return object value. */
    register Tcl_Obj *objPtr)/* Tcl object to be returned. If NULL, the obj
 * result is made an empty string object. */
{
    register Interp *iPtr = (Interp *) interp;
    register Tcl_Obj *oldObjResult = iPtr->objResultPtr;

    iPtr->objResultPtr = objPtr;
    Tcl_IncrRefCount(objPtr);/* since interp result is a reference */
...
msoferplain2011-07-12 19:34:33
allow_comments - 1

dup of 3363556 (submitted twice)
Log in (anonymous is fine) to add a comment.