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.



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@402767 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Michelson
2013-11-12 19:05:44 +00:00
parent 1d6201ab9c
commit 15feef01a0

View File

@@ -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;