aboutsummaryrefslogtreecommitdiffstats
path: root/pbx/pbx_dundi.c
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-04-30 05:02:07 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-04-30 05:02:07 +0000
commita1c748420c2c3a75ddac20133bdae84de41f5636 (patch)
treecec2b9b8ea9dae77557fd7191d33439762f5d2c2 /pbx/pbx_dundi.c
parent4fba9b433c84f928b0137121db5f8fcc11d8147b (diff)
handle a memory allocation failure immediately so the following large block
does not have to be indented git-svn-id: http://svn.digium.com/svn/asterisk/trunk@23480 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'pbx/pbx_dundi.c')
-rw-r--r--pbx/pbx_dundi.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/pbx/pbx_dundi.c b/pbx/pbx_dundi.c
index bb5be9f59..4afe0cee2 100644
--- a/pbx/pbx_dundi.c
+++ b/pbx/pbx_dundi.c
@@ -3995,13 +3995,11 @@ static void build_mapping(char *name, char *value)
break;
}
if (!map) {
- map = ast_calloc(1, sizeof(*map));
- if (map) {
- AST_LIST_INSERT_HEAD(&mappings, map, list);
- map->dead = 1;
- }
+ if (!(map = ast_calloc(1, sizeof(*map))))
+ return;
+ AST_LIST_INSERT_HEAD(&mappings, map, list);
+ map->dead = 1;
}
- if (map) {
map->options = 0;
memset(fields, 0, sizeof(fields));
x = 0;
@@ -4046,7 +4044,6 @@ static void build_mapping(char *name, char *value)
}
} else
ast_log(LOG_WARNING, "Expected at least %d arguments in map, but got only %d\n", 4, x);
- }
}
}