diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-09-30 16:55:21 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-09-30 16:55:21 +0000 |
commit | ca09bf6d678100b5cf892328511d073a6f9282b8 (patch) | |
tree | ceb65d81fecfc21bb089d21f735c4359e27d58c2 /main | |
parent | 9ae99e7c9b5cb5147ce08e10dba79a38ca2b902f (diff) |
Avoid a potential NULL dereference.
(closes issue #15865)
Reported by: kobaz
Patches:
20090915__issue15865.diff.txt uploaded by tilghman (license 14)
Tested by: kobaz
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@221200 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r-- | main/channel.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/main/channel.c b/main/channel.c index a674e0a16..48ec63bf6 100644 --- a/main/channel.c +++ b/main/channel.c @@ -1980,9 +1980,9 @@ int ast_waitfordigit_full(struct ast_channel *c, int ms, int audiofd, int cmdfd) static void ast_read_generator_actions(struct ast_channel *chan, struct ast_frame *f) { - if (chan->generatordata && !ast_internal_timing_enabled(chan)) { + if (chan->generator && chan->generator->generate && chan->generatordata && !ast_internal_timing_enabled(chan)) { void *tmp = chan->generatordata; - int (*generate)(struct ast_channel *chan, void *tmp, int datalen, int samples) = NULL; + int (*generate)(struct ast_channel *chan, void *tmp, int datalen, int samples) = chan->generator->generate; int res; int samples; @@ -2002,9 +2002,6 @@ static void ast_read_generator_actions(struct ast_channel *chan, struct ast_fram samples = f->samples; } - if (chan->generator->generate) { - generate = chan->generator->generate; - } /* This unlock is here based on two assumptions that hold true at this point in the * code. 1) this function is only called from within __ast_read() and 2) all generators * call ast_write() in their generate callback. |