[asterisk-commits] eliel: branch eliel/appdelim r181209 - /team/eliel/appdelim/main/pbx.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Mar 11 08:04:51 CDT 2009


Author: eliel
Date: Wed Mar 11 08:04:48 2009
New Revision: 181209

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=181209
Log:
Avoid allocating more space than what is really needed.

Modified:
    team/eliel/appdelim/main/pbx.c

Modified: team/eliel/appdelim/main/pbx.c
URL: http://svn.digium.com/svn-view/asterisk/team/eliel/appdelim/main/pbx.c?view=diff&rev=181209&r1=181208&r2=181209
==============================================================================
--- team/eliel/appdelim/main/pbx.c (original)
+++ team/eliel/appdelim/main/pbx.c Wed Mar 11 08:04:48 2009
@@ -3271,11 +3271,11 @@
 	AST_RWLIST_WRLOCK(&apps);
 	AST_RWLIST_TRAVERSE(&apps, cur, list) {
 		if (!strcasecmp(name, cur->name)) {
-			if (!(ret = ast_threadstorage_get(&appfun_syntax_buf, strlen(cur->syntax) + 2))) {
+			if (!(ret = ast_threadstorage_get(&appfun_syntax_buf, strlen(cur->syntax) + 1))) {
 				AST_RWLIST_UNLOCK(&apps);
 				return NULL;
 			}
-			ast_copy_string(ret, cur->syntax, strlen(cur->syntax));
+			ast_copy_string(ret, cur->syntax, strlen(cur->syntax) + 1);
 			AST_RWLIST_UNLOCK(&apps);
 			return ret;
 		}
@@ -3285,7 +3285,7 @@
 	if (!(ret = ast_threadstorage_get(&appfun_syntax_buf, strlen(name) + 1))) {
 		return NULL;
 	}
-	ast_copy_string(ret, name, strlen(name));
+	ast_copy_string(ret, name, strlen(name) + 1);
 
 	/* at least return something. */
 	return ret;
@@ -3299,7 +3299,7 @@
 	AST_RWLIST_WRLOCK(&acf_root);
 	AST_RWLIST_TRAVERSE(&acf_root, cur, acflist) {
 		if (!strcmp(name, cur->name)) {
-			if (!(ret = ast_threadstorage_get(&appfun_syntax_buf, strlen(cur->syntax) + 2))) {
+			if (!(ret = ast_threadstorage_get(&appfun_syntax_buf, strlen(cur->syntax) + 1))) {
 				AST_RWLIST_UNLOCK(&acf_root);
 				return NULL;
 			}
@@ -3310,7 +3310,7 @@
 	}
 	AST_RWLIST_UNLOCK(&acf_root);
 
-	if (!(ret = ast_threadstorage_get(&appfun_syntax_buf, strlen(name) + 2))) {
+	if (!(ret = ast_threadstorage_get(&appfun_syntax_buf, strlen(name) + 1))) {
 		return NULL;
 	}
 	ast_copy_string(ret, name, strlen(name) + 1);




More information about the asterisk-commits mailing list