提交 42f8237e authored 作者: Michael Jerris's avatar Michael Jerris

fix checks in new logger function.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3013 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 ab65dab0
......@@ -1686,25 +1686,27 @@ static const switch_loadable_module_interface_t sofia_module_interface = {
static void logger(void *logarg, char const *fmt, va_list ap)
{
char *data;
int ret;
char *data = NULL;
if (fmt) {
#ifdef HAVE_VASPRINTF
int ret;
ret = vasprintf(&data, fmt, ap);
if ((ret == -1) || !data) {
return;
}
#else
data = (char *) malloc(2048);
vsnprintf(data, 2048, fmt, ap);
#endif
if (ret == -1) {
if (data) {
vsnprintf(data, 2048, fmt, ap);
} else {
return;
}
#endif
}
if (data) {
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, (char*) "%s", data);
free(data);
}
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, (char*) "%s", data);
free(data);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论