[svn-commits] jpeeler: branch jpeeler/bug13173 r151322 - /team/jpeeler/bug13173/apps/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Oct 20 15:57:04 CDT 2008


Author: jpeeler
Date: Mon Oct 20 15:57:03 2008
New Revision: 151322

URL: http://svn.digium.com/view/asterisk?view=rev&rev=151322
Log:
fix potential memory leak, considering playing conference part sound in announce thread to avoid delaying hangup

Modified:
    team/jpeeler/bug13173/apps/app_meetme.c

Modified: team/jpeeler/bug13173/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/jpeeler/bug13173/apps/app_meetme.c?view=diff&rev=151322&r1=151321&r2=151322
==============================================================================
--- team/jpeeler/bug13173/apps/app_meetme.c (original)
+++ team/jpeeler/bug13173/apps/app_meetme.c Mon Oct 20 15:57:03 2008
@@ -1274,7 +1274,7 @@
 		pthread_join(conf->announcethread, NULL);
 		ast_clear_flag(conf->chan, AST_FLAG_BLOCKING);
 		while ((item = AST_LIST_REMOVE_HEAD(&conf->announcelist, list))) {
-	ast_log(LOG_NOTICE, "freeing item\n");
+	ast_log(LOG_NOTICE, "jpeeler: freeing item path=%s\n", item->namerecloc);
 			free(item);
 		}
 	}
@@ -1406,12 +1406,9 @@
 		if (AST_LIST_EMPTY(&conf->announcelist))
 			ast_cond_wait(&conf->announcelist_addition, &conf->announcelist.lock);
 		next = AST_LIST_FIRST(&conf->announcelist);
-		AST_LIST_HEAD_INIT_NOLOCK(&conf->announcelist);
 		AST_LIST_UNLOCK(&conf->announcelist);
 
 		while ((current = next)) {
-			next = AST_LIST_NEXT(current, list);
-
 			if (ast_fileexists(current->namerecloc, NULL, NULL)) {
 				if ((current->confchan) && (current->confusers > 1)) {
 					if (!ast_streamfile(current->confchan, current->namerecloc, current->language))
@@ -1421,7 +1418,12 @@
 				}
 				ast_filedelete(current->namerecloc, NULL);
 			}
+			pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL); 
+			next = AST_LIST_NEXT(current, list);
+			AST_LIST_REMOVE_HEAD(&conf->announcelist, list);
+ast_log(LOG_NOTICE, "jpeeler: freeing item path=%s\n", current->namerecloc);
 			free(current);
+			pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
 		}
 	}
 
@@ -2331,13 +2333,13 @@
 	if (!(confflags & CONFFLAG_QUIET) && !(confflags & CONFFLAG_MONITOR) && !(confflags & CONFFLAG_ADMIN))
 		conf_play(chan, conf, LEAVE);
 
-	if (!(confflags & CONFFLAG_QUIET) && ((confflags & CONFFLAG_INTROUSER) || (confflags & CONFFLAG_INTROUSERNOREVIEW))) {
+	if (!(confflags & CONFFLAG_QUIET) && ((confflags & CONFFLAG_INTROUSER) || (confflags & CONFFLAG_INTROUSERNOREVIEW)) && conf->users > 1) {
 		struct announce_listitem *item = ast_calloc(1, sizeof(*item));
-ast_log(LOG_NOTICE, "adding item\n");
 		ast_copy_string(item->namerecloc, user->namerecloc, sizeof(item->namerecloc));
 		ast_copy_string(item->language, chan->language, sizeof(item->language));
 		item->confchan = conf->chan;
 		item->confusers = conf->users;
+ast_log(LOG_NOTICE, "jpeeler: adding item with path=%s\n", item->namerecloc);
 		AST_LIST_LOCK(&conf->announcelist);
 		AST_LIST_INSERT_TAIL(&conf->announcelist, item, list);
 		ast_cond_signal(&conf->announcelist_addition);




More information about the svn-commits mailing list