#5143 Extra Tcl_DecrRefCount in Tcl_LSearchjObjCmd

obsolete: 8.6b3

There is a Tcl_DecrRefCount (patObj) (~line 3425 of TclCmdIL.c) which does not seem to have a matching Tcl_IncrRefCount. patObj is not newly allocated, it is equated to objv[...] on line 3197.

I don't know how to exercise that code, because I don't think the enclosing Tcl_RegExpExecObj call enclosing it can actually fail, the regexp having been already successfully compiled before without errors further up in the code. So in that sense it might be dead code but still...



    • milestone: --> obsolete: 8.6b3
  • I've reviewed the code, and the only problem cases are when the RE engine core throws REG_ASSERT or REG_ESPACE. The first is a "Yow! RE engine bug found!" and the second is running out of memory for what is typically a modest memory allocation (i.e., highly fatal to Tcl which exercises the memory subsystem pretty hard). The glue layer connecting Tcl to the RE engine ensures that other error cases don't happen (we match our RE compilations and executions correctly) or are caught earlier.

    In other words, I don't think it is possible to actually exercise this bug.

    • priority: 5 --> 4