[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: Stefan Knoblich <s.knoblich@axsentis.de>
This commit is contained in:
Stefan Knoblich 2011-03-06 19:34:03 +01:00
parent 0911ed7408
commit 02b2926351
1 changed files with 1 additions and 1 deletions

View File

@ -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;