From: Joshua Colp Date: Tue, 21 Aug 2018 11:55:14 +0000 (-0500) Subject: Merge "pbx_dundi.c: Misc memory management fixes when destroying peers" into 15 X-Git-Tag: 15.6.0-rc1~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ced69e2b58e6f60fd9a1718a0ca62a37a489feb3;p=thirdparty%2Fasterisk.git Merge "pbx_dundi.c: Misc memory management fixes when destroying peers" into 15 --- ced69e2b58e6f60fd9a1718a0ca62a37a489feb3 diff --cc pbx/pbx_dundi.c index 827402840f,6dab9b4b08..d983795ce6 --- a/pbx/pbx_dundi.c +++ b/pbx/pbx_dundi.c @@@ -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();