fix(tsc): fix invalid free
This commit is contained in:
parent
9a5db03293
commit
86c98f1f21
|
@ -84,7 +84,7 @@ static FORCE_INLINE int64_t taosGetTimestampNs() {
|
|||
|
||||
char *taosStrpTime(const char *buf, const char *fmt, struct tm *tm);
|
||||
struct tm *taosLocalTime(const time_t *timep, struct tm *result);
|
||||
struct tm *taosLocalTimeNolock(struct tm *result, const time_t *timep, time_t tz, int dst);
|
||||
struct tm *taosLocalTimeNolock(struct tm *result, const time_t *timep, int dst);
|
||||
time_t taosTime(time_t *t);
|
||||
time_t taosMktime(struct tm *timep);
|
||||
|
||||
|
|
|
@ -455,7 +455,7 @@ static int isLeapYear(time_t year) {
|
|||
else
|
||||
return 1;
|
||||
}
|
||||
struct tm *taosLocalTimeNolock(struct tm *result, const time_t *timep, time_t tz, int dst) {
|
||||
struct tm *taosLocalTimeNolock(struct tm *result, const time_t *timep, int dst) {
|
||||
if (result == NULL) {
|
||||
return localtime(timep);
|
||||
}
|
||||
|
@ -496,6 +496,7 @@ struct tm *taosLocalTimeNolock(struct tm *result, const time_t *timep, time_t tz
|
|||
}
|
||||
#elif defined(LINUX)
|
||||
time_t secsMin = 60, secsHour = 3600, secsDay = 3600 * 24;
|
||||
long tz = timezone;
|
||||
|
||||
time_t t = *timep;
|
||||
t -= tz; /* Adjust for timezone. */
|
||||
|
|
|
@ -114,18 +114,6 @@ static void taosCloseLogByFd(TdFilePtr pFile);
|
|||
static int32_t taosOpenLogFile(char *fn, int32_t maxLines, int32_t maxFileNum);
|
||||
static int32_t taosCompressFile(char *srcFileName, char *destFileName);
|
||||
|
||||
static FORCE_INLINE long taosGetTimeZone() {
|
||||
#if defined(__linux__) || defined(__sun)
|
||||
return timezone;
|
||||
#else
|
||||
|
||||
// struct timeval tv;
|
||||
// struct timezone tz;
|
||||
// gettimeofday(&tv, &tz);
|
||||
|
||||
// return tz.tz_minuteswest * 60L;
|
||||
#endif
|
||||
}
|
||||
static FORCE_INLINE void taosUpdateDaylight() {
|
||||
struct tm Tm, *ptm;
|
||||
struct timeval timeSecs;
|
||||
|
@ -446,7 +434,7 @@ static inline int32_t taosBuildLogHead(char *buffer, const char *flags) {
|
|||
|
||||
taosGetTimeOfDay(&timeSecs);
|
||||
time_t curTime = timeSecs.tv_sec;
|
||||
ptm = taosLocalTimeNolock(&Tm, &curTime, taosGetTimeZone(), taosGetDaylight());
|
||||
ptm = taosLocalTimeNolock(&Tm, &curTime, taosGetDaylight());
|
||||
|
||||
return sprintf(buffer, "%02d/%02d %02d:%02d:%02d.%06d %08" PRId64 " %s", ptm->tm_mon + 1, ptm->tm_mday, ptm->tm_hour,
|
||||
ptm->tm_min, ptm->tm_sec, (int32_t)timeSecs.tv_usec, taosGetSelfPthreadId(), flags);
|
||||
|
|
Loading…
Reference in New Issue