fix possible bad pointer in global vars (please test)

This commit is contained in:
Anthony Minessale 2011-02-02 16:05:51 -06:00
parent 4ae8282e6c
commit 257bf9a46c
2 changed files with 10 additions and 3 deletions

View File

@ -1067,9 +1067,16 @@ static const char* channel_get_variable(switch_core_session_t *session, switch_e
return variable;
}
}
// This is unsafe, I don't see anywhere in the whole code where this is called with NULL session anyway.
// There is a new switch_core_get_variable_dup that will strdup it for you and then you must free it.
// That messes up the abstraction completely so I am just commenting it out for you.....
/*
if ((variable = switch_core_get_variable(variable_name))) {
return variable;
}
*/
return NULL;
}

View File

@ -1234,19 +1234,19 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
zap_set_string(caller_data.ani.digits, dest);
}
if ((var = switch_event_get_header(var_event, "openzap_outbound_ton")) || (var = switch_core_get_variable("openzap_outbound_ton"))) {
if ((var = switch_event_get_header(var_event, "openzap_outbound_ton"))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Setting TON to: %s\n", var);
zap_set_ton(var, &caller_data.ani.type);
} else {
caller_data.ani.type = outbound_profile->destination_number_ton;
}
if ((var = switch_event_get_header(var_event, "openzap_custom_call_data")) || (var = switch_core_get_variable("openzap_custom_call_data"))) {
if ((var = switch_event_get_header(var_event, "openzap_custom_call_data"))) {
zap_set_string((char *)caller_data.raw_data, var);
caller_data.raw_data_len = strlen(var);
}
if ((var = switch_event_get_header(var_event, "openzap_outbound_npi")) || (var = switch_core_get_variable("openzap_outbound_npi"))) {
if ((var = switch_event_get_header(var_event, "openzap_outbound_npi"))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Setting NPI to: %s\n", var);
zap_set_npi(var, &caller_data.ani.plan);
} else {