diff options
Diffstat (limited to 'main/channel.c')
-rw-r--r-- | main/channel.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/main/channel.c b/main/channel.c index 373d6045d..3d8e22302 100644 --- a/main/channel.c +++ b/main/channel.c @@ -2967,11 +2967,6 @@ struct ast_channel *ast_waitfor_nandfds(struct ast_channel **c, int n, int *fds, int fdno; } *fdmap = NULL; - if ((sz = n * AST_MAX_FDS + nfds)) { - pfds = alloca(sizeof(*pfds) * sz); - fdmap = alloca(sizeof(*fdmap) * sz); - } - if (outfd) { *outfd = -99999; } @@ -2979,6 +2974,14 @@ struct ast_channel *ast_waitfor_nandfds(struct ast_channel **c, int n, int *fds, *exception = 0; } + if ((sz = n * AST_MAX_FDS + nfds)) { + pfds = alloca(sizeof(*pfds) * sz); + fdmap = alloca(sizeof(*fdmap) * sz); + } else { + /* nothing to allocate and no FDs to check */ + return NULL; + } + /* Perform any pending masquerades */ for (x = 0; x < n; x++) { if (ast_channel_masq(c[x]) && ast_do_masquerade(c[x])) { |