Fix various problems detected with Valgrind.

* chan_console accessed pvts after deallocation.
 * cdr_mysql stored a pointer that was freed by realloc()
 * The module loader did not check usecount on shutdown, which led to chan_iax2
 reading a timer that was already unloaded.
 * The event subsystem sometimes creates an event with no IEs.  Due to a corner
 condition, the code would read beyond the memory boundary.
 * res_pktccops did not correctly check whether its monitor thread was started.
(closes issue #16062)
 Reported by: alexanderheinz
 Patches: 
       20091109__issue16062.diff.txt uploaded by tilghman (license 14)
 Tested by: tilghman


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@228798 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Tilghman Lesher
2009-11-09 07:37:52 +00:00
parent ec6f1f3ea4
commit c0b3c923a4
5 changed files with 39 additions and 23 deletions

View File

@@ -1446,7 +1446,7 @@ static int load_module(void)
static int unload_module(void)
{
if (!ast_mutex_lock(&pktccops_lock)) {
if (pktccops_thread && (pktccops_thread != AST_PTHREADT_STOP)) {
if ((pktccops_thread != AST_PTHREADT_NULL) && (pktccops_thread != AST_PTHREADT_STOP)) {
pthread_cancel(pktccops_thread);
pthread_kill(pktccops_thread, SIGURG);
pthread_join(pktccops_thread, NULL);