mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-15 17:27:02 +00:00
Pay attention to the return value of the manipulate function.
While this looks like an optimization, it prevents a crash from occurring when used with certain audiohook callbacks (diagnosed with SVN trunk, backported to 1.4 to keep the source consistent across versions). git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@224855 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -657,11 +657,17 @@ static struct ast_frame *audio_audiohook_write_list(struct ast_channel *chan, st
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/* Feed in frame to manipulation */
|
/* Feed in frame to manipulation */
|
||||||
audiohook->manipulate_callback(audiohook, chan, middle_frame, direction);
|
if (audiohook->manipulate_callback(audiohook, chan, middle_frame, direction)) {
|
||||||
|
/* Manipulation failed */
|
||||||
|
ast_frfree(middle_frame);
|
||||||
|
middle_frame = NULL;
|
||||||
|
}
|
||||||
ast_audiohook_unlock(audiohook);
|
ast_audiohook_unlock(audiohook);
|
||||||
}
|
}
|
||||||
AST_LIST_TRAVERSE_SAFE_END
|
AST_LIST_TRAVERSE_SAFE_END
|
||||||
end_frame = middle_frame;
|
if (middle_frame) {
|
||||||
|
end_frame = middle_frame;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now we figure out what to do with our end frame (whether to transcode or not) */
|
/* Now we figure out what to do with our end frame (whether to transcode or not) */
|
||||||
@@ -689,7 +695,9 @@ static struct ast_frame *audio_audiohook_write_list(struct ast_channel *chan, st
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* No frame was modified, we can just drop our middle frame and pass the frame we got in out */
|
/* No frame was modified, we can just drop our middle frame and pass the frame we got in out */
|
||||||
ast_frfree(middle_frame);
|
if (middle_frame) {
|
||||||
|
ast_frfree(middle_frame);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return end_frame;
|
return end_frame;
|
||||||
|
Reference in New Issue
Block a user