aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2009-01-19 15:52:15 +0000
committermmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2009-01-19 15:52:15 +0000
commitdb4dcb58ab0dc1eb89582bf55a67a2d35ccf9267 (patch)
tree0eceaa5e820b79d5677bb2a1a846916990fa248e
parentc869cfe17cc1661cda3786ed7e287694ef7e34ff (diff)
Prevent a crash in chan_local due to a potential NULL pointer dereference
Move the check for if both channels on a local_pvt have generators to below where p->chan is checked for NULLity (NULLness?). This prevents a crash from occurring if p->chan is NULL. (closes issue #14189) Reported by: sascha Patches: 14189.patch uploaded by putnopvut (license 60) Tested by: sascha git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@169210 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--channels/chan_local.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/channels/chan_local.c b/channels/chan_local.c
index b2e3c72b8..9f3dd1d77 100644
--- a/channels/chan_local.c
+++ b/channels/chan_local.c
@@ -168,10 +168,6 @@ static int local_queue_frame(struct local_pvt *p, int isoutbound, struct ast_fra
/* Recalculate outbound channel */
other = isoutbound ? p->owner : p->chan;
- /* do not queue frame if generator is on both local channels */
- if (us && us->generator && other->generator)
- return 0;
-
/* Set glare detection */
ast_set_flag(p, LOCAL_GLARE_DETECT);
if (ast_test_flag(p, LOCAL_CANCEL_QUEUE)) {
@@ -186,6 +182,10 @@ static int local_queue_frame(struct local_pvt *p, int isoutbound, struct ast_fra
return 0;
}
+ /* do not queue frame if generator is on both local channels */
+ if (us && us->generator && other->generator)
+ return 0;
+
/* Ensure that we have both channels locked */
while (other && ast_channel_trylock(other)) {
ast_mutex_unlock(&p->lock);