Overview
| Artifact ID: | 9f500f99a053288fccd48589ea51b82e193448f7 |
|---|---|
| Ticket: | 862924ffffffffffffffffffffffffffffffffff
Memory Leak in Time/Date-Functions |
| User & Date: | tclfuchs on 2003-12-22 17:17:43 |
Changes
- icomment:
Logged In: YES user_id=934391 Could you please also have a look at unix/tclUnixTime.c. Maybe it could be rewritten as struct tm *TclpGetDate(time, useGMT) TclpTime_t time; int useGMT; struct tm *temp; { CONST time_t *tp = (CONST time_t *)time; if (useGMT) { temp=gmtime(tp); free(tp); return temp; } else { temp=localtime(tp); free(tp); return temp; } } The same applies to /win/tclWinTime.c with variable tp, but this function is a bit more tricky. In /mac/tclMacTime.c the function TclpGetDate seems to be not-threadsafe. A pointer to static variable "statictime" is returned from this function, but this variable is influenced by other threads. Even in single-threaded programms problems arise, if not carefully used: The user has to copy the data of the returned pointer to another memory location, because the next call to TclpGetDate would override the result of the previous call. - login: "tclfuchs"
- mimetype: "text/plain"
- username: "tclfuchs"