[asterisk-commits] mnicholson: branch 1.4 r287555 - /branches/1.4/main/pbx.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Sep 20 10:48:19 CDT 2010
Author: mnicholson
Date: Mon Sep 20 10:48:14 2010
New Revision: 287555
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=287555
Log:
Use ast_dynamic_str when processing hint state changes
(related to issue #17928)
Reported by: mdu113
Modified:
branches/1.4/main/pbx.c
Modified: branches/1.4/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.4/main/pbx.c?view=diff&rev=287555&r1=287554&r2=287555
==============================================================================
--- branches/1.4/main/pbx.c (original)
+++ branches/1.4/main/pbx.c Mon Sep 20 10:48:14 2010
@@ -2011,25 +2011,28 @@
void ast_hint_state_changed(const char *device)
{
struct ast_hint *hint;
+ struct ast_dynamic_str *str;
+
+ if (!(str = ast_dynamic_str_create(1024))) {
+ return;
+ }
ast_rdlock_contexts();
AST_LIST_LOCK(&hints);
AST_LIST_TRAVERSE(&hints, hint, list) {
struct ast_state_cb *cblist;
- /* can't use ast_strdupa() here because we may run out of stack
- * space while looping over a large number of large strings */
- char *dup = ast_strdup(ast_get_extension_app(hint->exten));
- char *cur, *parse = dup;
+ char *cur, *parse;
int state;
+
+ ast_dynamic_str_set(&str, 0, "%s", ast_get_extension_app(hint->exten));
+ parse = str->str;
while ( (cur = strsep(&parse, "&")) ) {
if (!strcasecmp(cur, device))
break;
}
- ast_free(dup);
-
if (!cur)
continue;
@@ -2054,6 +2057,7 @@
AST_LIST_UNLOCK(&hints);
ast_unlock_contexts();
+ ast_free(str);
}
/*! \brief ast_extension_state_add: Add watcher for extension states */
More information about the asterisk-commits
mailing list