summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorTilghman Lesher <tilghman@meg.abyt.es>2009-09-30 16:56:42 +0000
committerTilghman Lesher <tilghman@meg.abyt.es>2009-09-30 16:56:42 +0000
commita4ece92018d051609c26e815fd966d045a3ebec3 (patch)
tree66b822e846f71cb3622306850a01c03208d470d6 /main
parent0e805a51ec92ee94c1dda87c901c7908d3b32d41 (diff)
Merged revisions 221200 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r221200 | tilghman | 2009-09-30 11:55:21 -0500 (Wed, 30 Sep 2009) | 7 lines 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: https://origsvn.digium.com/svn/asterisk/trunk@221201 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main')
-rw-r--r--main/channel.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/main/channel.c b/main/channel.c
index eeedd4e9f..6c0d5b65b 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -2977,9 +2977,9 @@ static void send_dtmf_event(const struct ast_channel *chan, const char *directio
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;
@@ -2998,9 +2998,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.