diff options
Diffstat (limited to 'cdr/cdr_mysql.c')
-rwxr-xr-x | cdr/cdr_mysql.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/cdr/cdr_mysql.c b/cdr/cdr_mysql.c index 666a4e29a..137febb46 100755 --- a/cdr/cdr_mysql.c +++ b/cdr/cdr_mysql.c @@ -39,21 +39,18 @@ static MYSQL *mysql; static int mysql_log(struct ast_cdr *cdr) { struct tm *tm; - struct timeval *tv; - struct timezone *tz; - char *sqlcmd, *timestr; + struct timeval tv; + struct timezone tz; + char *sqlcmd, timestr[128]; time_t t; - tv = (struct timeval *)malloc(sizeof(struct timeval)); - tz = (struct timezone *)malloc(sizeof(struct timezone)); sqlcmd = (char *)malloc(2048); - timestr = (char*)malloc(128); memset(sqlcmd,0,2048); - gettimeofday(tv,tz); - t = tv->tv_sec; + gettimeofday(&tv,&tz); + t = tv.tv_sec; tm = localtime(&t); strftime(timestr,128,DATE_FORMAT,tm); |