<i>Memory Leak in Time/Date-Functions</i> status still Open with 4 other changes
by
.
D 2003-12-22T17:17:43
J icomment Logged\sIn:\sYES\s\nuser_id=934391\n\nCould\syou\splease\salso\shave\sa\slook\sat\sunix/tclUnixTime.c.\nMaybe\sit\scould\sbe\srewritten\sas\nstruct\stm\s*TclpGetDate(time,\suseGMT)\n\s\s\s\sTclpTime_t\stime;\n\s\s\s\sint\suseGMT;\n\s\s\sstruct\stm\s*temp;\n{\n\s\s\s\sCONST\stime_t\s*tp\s=\s(CONST\stime_t\s*)time;\n\n\s\s\s\sif\s(useGMT)\s{\n\s\s\s\s\s\s\s\stemp=gmtime(tp);\n\s\s\s\s\s\s\s\sfree(tp);\n\s\s\s\s\s\s\s\sreturn\stemp;\n\s\s\s\s}\selse\s{\n\s\s\s\s\s\s\s\stemp=localtime(tp);\n\s\s\s\s\s\s\s\sfree(tp);\n\s\s\s\s\s\s\s\sreturn\stemp;\n\s\s\s\s}\n}\n\nThe\ssame\sapplies\sto\s/win/tclWinTime.c\swith\svariable\stp,\sbut\nthis\sfunction\sis\sa\sbit\smore\stricky.\n\nIn\s/mac/tclMacTime.c\sthe\sfunction\sTclpGetDate\sseems\sto\sbe\nnot-threadsafe.\sA\spointer\sto\sstatic\svariable\s"statictime"\sis\nreturned\sfrom\sthis\sfunction,\sbut\sthis\svariable\sis\sinfluenced\nby\sother\sthreads.\sEven\sin\ssingle-threaded\sprogramms\sproblems\narise,\sif\snot\scarefully\sused:\sThe\suser\shas\sto\scopy\sthe\sdata\nof\sthe\sreturned\spointer\sto\sanother\smemory\slocation,\sbecause\nthe\snext\scall\sto\sTclpGetDate\swould\soverride\sthe\sresult\sof\nthe\sprevious\scall.\n\n
J login tclfuchs
J mimetype text/plain
J username tclfuchs
K 862924ffffffffffffffffffffffffffffffffff
U tclfuchs
Z a7a0fd20d606a2622c38aee8de21232b