mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-05 22:28:46 +00:00
fix small leak in strftime
This commit is contained in:
parent
ee91b6374a
commit
bbbd67ba08
@ -1359,22 +1359,23 @@ SWITCH_STANDARD_API(strftime_api_function)
|
|||||||
mycmd = strdup(cmd);
|
mycmd = strdup(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!zstr(mycmd) && (p = strchr(cmd, '|'))) {
|
if (!zstr(mycmd) && (p = strchr(mycmd, '|'))) {
|
||||||
*p++ = '\0';
|
*p++ = '\0';
|
||||||
|
|
||||||
thetime = switch_time_make(atol(cmd), 0);
|
thetime = switch_time_make(atol(mycmd), 0);
|
||||||
cmd = p + 1;
|
mycmd = p + 1;
|
||||||
} else {
|
} else {
|
||||||
thetime = switch_micro_time_now();
|
thetime = switch_micro_time_now();
|
||||||
}
|
}
|
||||||
switch_time_exp_lt(&tm, thetime);
|
switch_time_exp_lt(&tm, thetime);
|
||||||
|
|
||||||
if (zstr(cmd)) {
|
if (zstr(mycmd)) {
|
||||||
switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
|
switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
|
||||||
} else {
|
} else {
|
||||||
switch_strftime(date, &retsize, sizeof(date), cmd, &tm);
|
switch_strftime(date, &retsize, sizeof(date), mycmd, &tm);
|
||||||
}
|
}
|
||||||
stream->write_function(stream, "%s", date);
|
stream->write_function(stream, "%s", date);
|
||||||
|
switch_safe_free(mycmd);
|
||||||
|
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user