]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merge "pbx_dundi.c: Misc memory management fixes when destroying peers" into 15
authorJoshua Colp <jcolp@digium.com>
Tue, 21 Aug 2018 11:55:14 +0000 (06:55 -0500)
committerGerrit Code Review <gerrit2@gerrit.digium.api>
Tue, 21 Aug 2018 11:55:14 +0000 (06:55 -0500)
1  2 
pbx/pbx_dundi.c

diff --cc pbx/pbx_dundi.c
index 827402840f4e10d81cea172a62e8552b79007ccf,6dab9b4b08363bd68277db92c281fba1f05ad277..d983795ce628191637c16e08dbbbe446155017ee
@@@ -4961,25 -4996,19 +4990,22 @@@ static int unload_module(void
  
        /* Stop all currently running threads */
        dundi_shutdown = 1;
 -      if (previous_netthreadid != AST_PTHREADT_NULL) {
 -              pthread_kill(previous_netthreadid, SIGURG);
 -              pthread_join(previous_netthreadid, NULL);
 -      }
 -      if (previous_precachethreadid != AST_PTHREADT_NULL) {
 -              pthread_kill(previous_precachethreadid, SIGURG);
 -              pthread_join(previous_precachethreadid, NULL);
 -      }
 -      if (previous_clearcachethreadid != AST_PTHREADT_NULL) {
 -              pthread_cancel(previous_clearcachethreadid);
 -              pthread_join(previous_clearcachethreadid, NULL);
 +      if (netthreadid != AST_PTHREADT_NULL) {
 +              pthread_kill(netthreadid, SIGURG);
 +              pthread_join(netthreadid, NULL);
 +              netthreadid = AST_PTHREADT_NULL;
 +      }
 +      if (precachethreadid != AST_PTHREADT_NULL) {
 +              pthread_kill(precachethreadid, SIGURG);
 +              pthread_join(precachethreadid, NULL);
 +              precachethreadid = AST_PTHREADT_NULL;
 +      }
 +      if (clearcachethreadid != AST_PTHREADT_NULL) {
 +              pthread_cancel(clearcachethreadid);
 +              pthread_join(clearcachethreadid, NULL);
 +              clearcachethreadid = AST_PTHREADT_NULL;
        }
  
-       close(netsocket);
-       io_context_destroy(io);
        mark_mappings();
        prune_mappings();
        mark_peers();