提交 02b29263 authored 作者: Stefan Knoblich's avatar Stefan Knoblich

[FreeTDM] Fix segfault in ftdm_analog_configure_span() on startup.

Using ftdm_log_chan() in ftdm_analog_configure_span() is a bad idea,
since the span won't have any channels assigned.

This bug powered by declaring all variables at the top of the function,
even if they are used in an if branch at the end.

A C99'ish:

	if (callwaiting) {
		for (unsigned int i = 1; i <= span->span->chan_count; i++) {
			/* ... */
		}
	}

would have alerted the developer adding the log statement.
But since we can't have nice things (thanks MSVC for not supporting C99!)
</rant>
Signed-off-by: 's avatarStefan Knoblich <s.knoblich@axsentis.de>
上级 0911ed74
......@@ -226,7 +226,7 @@ static FIO_SIG_CONFIGURE_FUNCTION(ftdm_analog_configure_span)
if (wait_dialtone_timeout < 0) {
wait_dialtone_timeout = 0;
}
ftdm_log_chan(span->channels[i], FTDM_LOG_DEBUG, "Wait dial tone ms = %d\n", wait_dialtone_timeout);
ftdm_log(FTDM_LOG_DEBUG, "Wait dial tone ms = %d\n", wait_dialtone_timeout);
} else if (!strcasecmp(var, "enable_callerid")) {
if (!(val = va_arg(ap, char *))) {
break;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论