Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 9f500f99a053288fccd48589ea51b82e193448f7
Ticket: 862924ffffffffffffffffffffffffffffffffff
Memory Leak in Time/Date-Functions
User & Date: tclfuchs on 2003-12-22 17:17:43
Changes

  1. 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.
    
    
    
  2. login: "tclfuchs"
  3. mimetype: "text/plain"
  4. username: "tclfuchs"