.
D 2003-06-18T22:24:41
J assignee msofer
J cmimetype text/plain
J comment Hi,\n\nIn\stclResult.c\s\sinside\sfunction\sResetObjResult(iPtr)\n\nWould\syou\sconsider\n\ninstead\sof...\n\s\s\s\sif\s(Tcl_IsShared(objResultPtr))\s{\n\s\s\s\s\s\s\s...\n\s\s\s\s}\selse\s{\n\s\s\s\s\s\s\s\sif\s((objResultPtr->bytes\s!=\sNULL)\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s&&\s(objResultPtr->bytes\s!=\s\ntclEmptyStringRep))\s{\n\s\s\s\s\s\s\s\s\s\s\s\sckfree((char\s*)\sobjResultPtr->bytes);\n\s\s\s\s\s\s\s\s}\n\s\s\s\s\s\s\s\sobjResultPtr->bytes\s\s=\stclEmptyStringRep;\n\s\s\s\s\s\s\s\sobjResultPtr->length\s=\s0;\n\s\s\s\s\s\s\s\sif\s((objResultPtr->typePtr\s!=\sNULL)\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s&&\s(objResultPtr->typePtr->freeIntRepProc\s!\n=\sNULL))\s{\n\s\s\s\s\s\s\s\s\s\s\s\sobjResultPtr->typePtr->freeIntRepProc\n(objResultPtr);\n\s\s\s\s\s\s\s\s}\n\s\s\s\s\s\s\s\sobjResultPtr->typePtr\s=\s(Tcl_ObjType\s*)\sNULL;\n\s\s\s\s}\n\n\nconsider...\n\s\s\s\sif\s(Tcl_IsShared(objResultPtr))\s{\n\s\s\s\s\s\s\s...\n\s\s\s\s}\selse\s{\n\s\s\s\s\s\s\s\sTclDecrRefCount(objResultPtr);\n\s\s\s\s\s\s\s\s\s\s/*\sThis\sautomatically\n\s\s\s\s\s\s\s\s\s\s\s\s\scalls\sthe\sfree\sfunction\sif\sresult\sobject\n\s\s\s\s\s\s\s\s\s\s\s\s\sholds\sits\sown\sinternal\srepresentation.\n\s\s\s\s\s\s\s\s\s\s\s\s\sAnd\sdepending\son\sthe\sfree\sfunction\sof\sthe\s\nregistered\stype\n\s\s\s\s\s\s\s\s\s\s\s\s\sIt\smight\salready\sinvalidate\sthe\s'bytes'\sfield\sof\s\nthe\sTcl_Obj\n\s\s\s\s\s\s\s\s\s\s\s\s\sand\sset\sthe\s'bytes'\sto\sNULL\sand\s\n\s\s\s\s\s\s\s\s\s\s\s\s\sthe\s'length'\sto\szero.\n\s\s\s\s\s\s\s\s\s\s*/\n\s\s\s\s\s\s\s\sif\s((objResultPtr->bytes\s!=\sNULL)\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s&&\s(objResultPtr->bytes\s!=\s\ntclEmptyStringRep))\s{\n\s\s\s\s\s\s\s\s\s\s\s\sckfree((char\s*)\sobjResultPtr->bytes);\n\s\s\s\s\s\s\s\s}\n\s\s\s\s\s\s\s\sobjResultPtr->bytes\s\s=\stclEmptyStringRep;\n\s\s\s\s\s\s\s\sobjResultPtr->length\s=\s0;\n\s\s\s\s\s\s\s\sobjResultPtr->typePtr\s=\s(Tcl_ObjType\s*)\sNULL;\n\s\s\s\s\s\s\s\sTcl_IncrRefCount(objResultPtr);\n\s\s\s\s}\n\n\nI'm\snot\ssure\sif\sit's\sa\sbug,\sbut\swith\sthe\scurrent\s\nimplementation,\sthe\sregistered\sfree\sfunction\sis\scalled\s\nwhen\srefCount\sis\sstill\sone.\n\nMoreover,\sif\sthe\sresult\sobject\sholds\sits\sinternal\s\nrepresentation,\sthe\sbytes\sfield\smay\shold\sths\sstring\sthat\s\nis\sobtained\sfrom\scalling\sTcl_UpdateStringObj,\swhich\scalls\s\nthe\sregistered\sUpdateStringProc.\n\nThe\ssoftware\sclient\sis\sfree\sto\suse\sits\sown\smemory\s\nallocator\swhen\supdating\sthe\sbytes\sstring.\s\sSo\sI\sthink\sit's\s\na\sbug\sto\sassume\sthat\sthe\sbytes\sis\sallocated\susing\s\nckalloc.\n\n--\sYohan
J foundin None
J priority 5\sMedium
J resolution None
J status Open
J submitter ysutjandra
J subsystem 10.\sObjects
J title ResetObjResult\sto\scall\sregistered\sfree\sfunction\sfirst\stime
J type RFE
K 756883ffffffffffffffffffffffffffffffffff
U ysutjandra
Z 625e9c3444590352c2e97faeae030479