]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix small issue
authorAnthony Minessale <anthony.minessale@gmail.com>
Fri, 9 May 2008 19:35:51 +0000 (19:35 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Fri, 9 May 2008 19:35:51 +0000 (19:35 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8341 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_sofia/mod_sofia.h
src/mod/endpoints/mod_sofia/sofia.c

index 153c0fd1d207130bfab4a89799df7a01a3c51880..45e9bc6ff6fba2665080673e451a0eac43d5ccfc 100644 (file)
@@ -101,6 +101,7 @@ struct sofia_private {
        sofia_gateway_t *gateway;
        char gateway_name[512];
        int destroy_nh;
+       int destroy_me;
 };
 
 #define set_param(ptr,val) if (ptr) {free(ptr) ; ptr = NULL;} if (val) {ptr = strdup(val);}
index b43ade9a44fcc6f84b1a72ed35a008c259c6ac7e..5a2d6430d1c953891d141db2a9149ca8548bdd5e 100644 (file)
@@ -350,6 +350,11 @@ void sofia_event_callback(nua_event_t event,
                break;
        }
 
+       if (sofia_private && sofia_private->destroy_me) {
+               free(sofia_private);
+               sofia_private = NULL;
+       }
+
        if (gateway) {
                sofia_reg_release_gateway(gateway);
        }
@@ -2108,14 +2113,14 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
                        if (tech_pvt->sofia_private) {
                                sofia_private = tech_pvt->sofia_private;
                                tech_pvt->sofia_private = NULL;
-                               free(sofia_private);
+                               sofia_private->destroy_me = 1;
                        }
 
                        tech_pvt->nh = NULL;            
 
 
                } else if (sofia_private) {
-                       free(sofia_private);
+                       sofia_private->destroy_me = 1;
                }
 
                if (nh) {