diff options
author | Mark Michelson <mmichelson@digium.com> | 2013-11-12 19:08:14 +0000 |
---|---|---|
committer | Mark Michelson <mmichelson@digium.com> | 2013-11-12 19:08:14 +0000 |
commit | c0bc3f6b4cbb988412a325b1de854c27d7db1cb6 (patch) | |
tree | 74994a49a6ee475263e5417f4c3a1e310045f67c | |
parent | 12a0edac6956e79503def0c8949823d8586c440a (diff) |
Move a NULL check to a place that makes more sense.
Two variables were being checked for NULLity immediately
after being declared NULL. I moved the NULL check until
after the variables are allocated.
This allows for the "channelvars" option in manager.conf
to work as intended again.
........
Merged revisions 402767 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@402768 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r-- | main/channel.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/main/channel.c b/main/channel.c index a44279d22..0b87b8039 100644 --- a/main/channel.c +++ b/main/channel.c @@ -7596,10 +7596,6 @@ struct varshead *ast_channel_get_manager_vars(struct ast_channel *chan) RAII_VAR(struct ast_str *, tmp, NULL, ast_free); struct manager_channel_variable *mcv; - if (!ret || !tmp) { - return NULL; - } - AST_RWLIST_RDLOCK(&channelvars); if (AST_LIST_EMPTY(&channelvars)) { @@ -7609,6 +7605,10 @@ struct varshead *ast_channel_get_manager_vars(struct ast_channel *chan) ret = ao2_alloc(sizeof(*ret), varshead_dtor); tmp = ast_str_create(16); + if (!ret || !tmp) { + return NULL; + } + AST_LIST_TRAVERSE(&channelvars, mcv, entry) { const char *val = NULL; struct ast_var_t *var; |