[asterisk-commits] mmichelson: branch 1.6.0 r208655 - /branches/1.6.0/apps/app_queue.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jul 24 14:33:59 CDT 2009


Author: mmichelson
Date: Fri Jul 24 14:33:54 2009
New Revision: 208655

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=208655
Log:
Blocked revisions 208622 via svnmerge

........
  r208622 | mmichelson | 2009-07-24 14:24:28 -0500 (Fri, 24 Jul 2009) | 16 lines
  
  Don't impose an arbitrary limit on member lines in queues.conf
  
  I know what some of you are thinking: "UGH! Mark, why are you using
  ast_strdup and ast_free for the string when you can just use ast_strdupa
  and let the memory free itself?! Have the bats been chewing on your brain
  again?"
  
  Based on past experiences, I don't like using ast_strdupa inside a loop.
  It's a good way to potentially exhaust stack space. Also, since this only
  happens when reloading queues, I don't think that heap allocations and
  frees are going to be a huge problem.
  
  (closes issue #15559)
  Reported by: amorsen
........

Modified:
    branches/1.6.0/apps/app_queue.c

Modified: branches/1.6.0/apps/app_queue.c
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.6.0/apps/app_queue.c?view=diff&rev=208655&r1=208654&r2=208655
==============================================================================
--- branches/1.6.0/apps/app_queue.c (original)
+++ branches/1.6.0/apps/app_queue.c Fri Jul 24 14:33:54 2009
@@ -5419,7 +5419,7 @@
 	struct ao2_iterator mem_iter;
 	int new;
 	const char *general_val = NULL;
-	char parse[80];
+	char *parse;
 	char *interface, *state_interface;
 	char *membername = NULL;
 	int penalty;
@@ -5538,7 +5538,9 @@
 						}
 
 						/* Add a new member */
-						ast_copy_string(parse, var->value, sizeof(parse));
+						if (!(parse = ast_strdup(var->value))) {
+							continue;
+						}
 						
 						AST_STANDARD_APP_ARGS(args, parse);
 
@@ -5583,6 +5585,7 @@
 						else {
 							q->membercount++;
 						}
+						ast_free(parse);
 					} else {
 						queue_set_param(q, var->name, var->value, var->lineno, 1);
 					}




More information about the asterisk-commits mailing list