]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
print sql *before* freeing it not after
authorAnthony Minessale <anthm@freeswitch.org>
Thu, 19 Jan 2012 17:38:15 +0000 (11:38 -0600)
committerAnthony Minessale <anthm@freeswitch.org>
Thu, 19 Jan 2012 17:38:15 +0000 (11:38 -0600)
src/mod/endpoints/mod_sofia/sofia_presence.c

index 1e7e68f750dc06d5225535d05d45990f49b768ea..3bdcb8fa57f3c2c4590b26c970e54e0552d380e7 100644 (file)
@@ -2938,13 +2938,15 @@ void sofia_presence_handle_sip_i_subscribe(int status,
        if ((sub_state != nua_substate_terminated)) {
                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));
-               switch_safe_free(sql);
+
 
                if (mod_sofia_globals.debug_presence > 0 || mod_sofia_globals.debug_sla > 0) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
                                                          "check subs sql: %s [%s]\n", sql, buf);
                }
 
+               switch_safe_free(sql);
+
                if ((subbed = atoi(buf)) > 0) {
                        sub_state = nua_substate_active;
                }