[asterisk-commits] mnicholson: branch 1.8 r287559 - in /branches/1.8: ./ main/pbx.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Sep 20 10:57:18 CDT 2010
Author: mnicholson
Date: Mon Sep 20 10:57:14 2010
New Revision: 287559
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=287559
Log:
Merged revisions 287558 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.6.2
................
r287558 | mnicholson | 2010-09-20 10:56:21 -0500 (Mon, 20 Sep 2010) | 14 lines
Use ast_str when processing hint state changes
Merged revisions 287555 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r287555 | mnicholson | 2010-09-20 10:48:14 -0500 (Mon, 20 Sep 2010) | 5 lines
Use ast_dynamic_str when processing hint state changes
(related to issue #17928)
Reported by: mdu113
........
................
Modified:
branches/1.8/ (props changed)
branches/1.8/main/pbx.c
Propchange: branches/1.8/
------------------------------------------------------------------------------
Binary property 'branch-1.6.2-merged' - no diff available.
Modified: branches/1.8/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/main/pbx.c?view=diff&rev=287559&r1=287558&r2=287559
==============================================================================
--- branches/1.8/main/pbx.c (original)
+++ branches/1.8/main/pbx.c Mon Sep 20 10:57:14 2010
@@ -4218,18 +4218,23 @@
static int handle_statechange(void *datap)
{
struct ast_hint *hint;
+ struct ast_str *str;
struct statechange *sc = datap;
+
+ if (!(str = ast_str_create(1024))) {
+ return -1;
+ }
ast_rdlock_contexts();
AST_RWLIST_RDLOCK(&hints);
AST_RWLIST_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_str_set(&str, 0, "%s", ast_get_extension_app(hint->exten));
+ parse = str->str;
while ( (cur = strsep(&parse, "&")) ) {
if (!strcasecmp(cur, sc->dev)) {
@@ -4237,8 +4242,6 @@
}
}
- ast_free(dup);
-
if (!cur) {
continue;
}
@@ -4266,6 +4269,7 @@
}
AST_RWLIST_UNLOCK(&hints);
ast_unlock_contexts();
+ ast_free(str);
ast_free(sc);
return 0;
}
More information about the asterisk-commits
mailing list