]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
free handles in error and failure conditions
authorBrian West <brian@freeswitch.org>
Sat, 21 Mar 2009 02:34:37 +0000 (02:34 +0000)
committerBrian West <brian@freeswitch.org>
Sat, 21 Mar 2009 02:34:37 +0000 (02:34 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12701 d0543943-73ff-0310-b7d9-9358b9ac24b2

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

index 25a7a56a9d288fe67ff2b6edc1b12fc6fffacfc5..3cdda830a1dc50e5aef9a602441ff5639f5bc889 100644 (file)
@@ -333,6 +333,14 @@ void sofia_event_callback(nua_event_t event,
        int locked = 0;
        int check_destroy = 1;
 
+       if (nh && sofia_private == &mod_sofia_globals.keep_private) {
+               if (status >= 300) {
+                       nua_handle_bind(nh, NULL);
+                       nua_handle_destroy(nh);
+                       return;
+               }
+       }
+
        if (sofia_private && sofia_private != &mod_sofia_globals.destroy_private && sofia_private != &mod_sofia_globals.keep_private) {
                if ((gateway = sofia_private->gateway)) {
                        if (switch_thread_rwlock_tryrdlock(gateway->profile->rwlock) != SWITCH_STATUS_SUCCESS) {
index 532a5b5a8c4d83ddcca2e8902ad95d4b9b29bdf8..d3820dc8ecd0c7fff9e6178500da3866923f73a7 100644 (file)
@@ -1405,6 +1405,7 @@ static int sofia_presence_mwi_callback2(void *pArg, int argc, char **argv, char
        }
        
        nh = nua_handle(profile->nua, NULL, NUTAG_URL(contact), SIPTAG_FROM_STR(id), SIPTAG_TO_STR(id), SIPTAG_CONTACT_STR(h->profile->url), TAG_END());
+       nua_handle_bind(nh, &mod_sofia_globals.destroy_private);
 
        nua_notify(nh,
                           NUTAG_NEWSUB(1),