[asterisk-commits] junky: branch junky/cli-tls r212242 - /team/junky/cli-tls/main/logger.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Aug 13 21:41:09 CDT 2009


Author: junky
Date: Thu Aug 13 21:41:05 2009
New Revision: 212242

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=212242
Log:
change the comparator and comparee to be non dynamic.
Both are forced to 128 chars.


Modified:
    team/junky/cli-tls/main/logger.c

Modified: team/junky/cli-tls/main/logger.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/junky/cli-tls/main/logger.c?view=diff&rev=212242&r1=212241&r2=212242
==============================================================================
--- team/junky/cli-tls/main/logger.c (original)
+++ team/junky/cli-tls/main/logger.c Thu Aug 13 21:41:05 2009
@@ -1818,9 +1818,8 @@
 	int res = -1;
 	struct logger_filter_list_item *filter;
 	struct ast_cli_filter *c;
-	char *comparator = NULL;
-	char *comparee = NULL;
-
+	char comparator[128];
+	char comparee[128];
 
 	channels = ast_threadstorage_get(&filter_channels, sizeof(*channels));
         if (!channels) {
@@ -1838,14 +1837,14 @@
 	
 		AST_LIST_TRAVERSE(&ast_cli_filters, c, filter_list) {
 			if ( c->type == 1 ) {
-				comparator = ast_strdup(filter->chan->name);
-				comparee = ast_strdup(c->name);
+				ast_copy_string(comparator, filter->chan->name, sizeof(comparator));
+				ast_copy_string(comparee, c->name, sizeof(comparee));
 			} else if (c->type == 2) {
-				comparator = ast_strdup(filter->chan->cid.cid_num);
-				comparee = ast_strdup(c->name);
+				ast_copy_string(comparator, filter->chan->cid.cid_num, sizeof(comparator));
+				ast_copy_string(comparee, c->name, sizeof(comparee));
 			} else if (c->type == 3) {
-				comparator = ast_strdup(filter->chan->accountcode);
-				comparee = ast_strdup(c->name);
+				ast_copy_string(comparator, filter->chan->accountcode, sizeof(comparator));
+				ast_copy_string(comparee, c->name, sizeof(comparee));
 			}
 
 			my_printf("filter name=[%s] type=[%d] comparator=[%s] comparee=[%s]\n",c->name, c->type, comparator, comparee);
@@ -1857,8 +1856,6 @@
 				res = 0;
 				break;
 			}
-			ast_free(comparator);
-			ast_free(comparee);
 		}
 	}
 	AST_LIST_TRAVERSE_SAFE_END;




More information about the asterisk-commits mailing list