print sql *before* freeing it not after

This commit is contained in:
Anthony Minessale 2012-01-19 11:38:15 -06:00
parent 5ef0c1cc5b
commit 9afbc007a2
1 changed files with 3 additions and 1 deletions

View File

@ -2938,13 +2938,15 @@ void sofia_presence_handle_sip_i_subscribe(int status,
if ((sub_state != nua_substate_terminated)) { if ((sub_state != nua_substate_terminated)) {
sql = switch_mprintf("select count(*) from sip_subscriptions where call_id='%q'", call_id); sql = switch_mprintf("select count(*) from sip_subscriptions where call_id='%q'", call_id);
sofia_glue_execute_sql2str(profile, profile->ireg_mutex, sql, buf, sizeof(buf)); sofia_glue_execute_sql2str(profile, profile->ireg_mutex, sql, buf, sizeof(buf));
switch_safe_free(sql);
if (mod_sofia_globals.debug_presence > 0 || mod_sofia_globals.debug_sla > 0) { if (mod_sofia_globals.debug_presence > 0 || mod_sofia_globals.debug_sla > 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
"check subs sql: %s [%s]\n", sql, buf); "check subs sql: %s [%s]\n", sql, buf);
} }
switch_safe_free(sql);
if ((subbed = atoi(buf)) > 0) { if ((subbed = atoi(buf)) > 0) {
sub_state = nua_substate_active; sub_state = nua_substate_active;
} }