be extra careful

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5789 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2007-10-03 23:42:40 +00:00
parent 3235d4b8ee
commit e44ad9588c
2 changed files with 10 additions and 9 deletions

View File

@ -1360,8 +1360,9 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
}
if (tech_pvt->sofia_private) {
free(tech_pvt->sofia_private);
sofia_private = tech_pvt->sofia_private;
tech_pvt->sofia_private = NULL;
free(sofia_private);
}
tech_pvt->nh = NULL;
@ -1998,7 +1999,6 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
NULL, NULL, NULL, MODNAME, context, destination_number);
if (tech_pvt->caller_profile) {
/* Loop thru unknown Headers Here so we can do something with them */
for (un = sip->sip_unknown; un; un = un->un_next) {
if (!strncasecmp(un->un_name, "Alert-Info", 10)) {
@ -2031,11 +2031,12 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);
}
if (!(tech_pvt->sofia_private = malloc(sizeof(*tech_pvt->sofia_private)))) {
if (!(sofia_private = malloc(sizeof(*sofia_private)))) {
abort();
}
memset(tech_pvt->sofia_private, 0, sizeof(*tech_pvt->sofia_private));
memset(sofia_private, 0, sizeof(*sofia_private));
tech_pvt->sofia_private = sofia_private;
if ((profile->pflags & PFLAG_PRESENCE)) {
sofia_presence_set_chat_hash(tech_pvt, sip);
}

View File

@ -511,7 +511,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
if (!tech_pvt->nh) {
char *d_url = NULL, *url = NULL;
sofia_private_t *sofia_private;
if (switch_strlen_zero(tech_pvt->dest)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "URL Error! [%s]\n", tech_pvt->dest);
return SWITCH_STATUS_FALSE;
@ -534,11 +534,11 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
switch_safe_free(d_url);
if (!(tech_pvt->sofia_private = malloc(sizeof(*tech_pvt->sofia_private)))) {
if (!(sofia_private = malloc(sizeof(*sofia_private)))) {
abort();
}
memset(tech_pvt->sofia_private, 0, sizeof(*tech_pvt->sofia_private));
memset(sofia_private, 0, sizeof(*sofia_private));
tech_pvt->sofia_private = sofia_private;
switch_copy_string(tech_pvt->sofia_private->uuid, switch_core_session_get_uuid(session), sizeof(tech_pvt->sofia_private->uuid));
nua_handle_bind(tech_pvt->nh, tech_pvt->sofia_private);