mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-30 02:26:23 +00:00
manager: Fix crash when appending a manager channel variable
In r399887, a minor performance improvement was introduced by not allocating the manager variable struct if it wasn't used. Unfortunately, when directly accessing an ast_channel struct, manager assumed that the struct was always allocated. Since this was no longer the case, things got a bit crashy. This fixes that problem by simply bypassing appending variables if the manager channel variable struct isn't there. git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@400058 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -5934,6 +5934,10 @@ static void append_channel_vars(struct ast_str **pbuf, struct ast_channel *chan)
|
|||||||
|
|
||||||
vars = ast_channel_get_manager_vars(chan);
|
vars = ast_channel_get_manager_vars(chan);
|
||||||
|
|
||||||
|
if (!vars) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
AST_LIST_TRAVERSE(vars, var, entries) {
|
AST_LIST_TRAVERSE(vars, var, entries) {
|
||||||
ast_str_append(pbuf, 0, "ChanVariable(%s): %s=%s\r\n", ast_channel_name(chan), var->name, var->value);
|
ast_str_append(pbuf, 0, "ChanVariable(%s): %s=%s\r\n", ast_channel_name(chan), var->name, var->value);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user