]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Add a check to fix a rare segmentation fault you'd get if ast_frdup couldn't allocate
authorBrett Bryant <bbryant@digium.com>
Tue, 21 Sep 2010 19:43:46 +0000 (19:43 +0000)
committerBrett Bryant <bbryant@digium.com>
Tue, 21 Sep 2010 19:43:46 +0000 (19:43 +0000)
memory on the first frame being queued in ast_queue_frame.

(closes issue #17882)
Reported by: seanbright
Tested by: seanbright

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@288005 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/channel.c

index 2f7a203763414e61424d17cfc7390581812e81e6..361286666545e229c309a2758e7f787dd7a2aade 100644 (file)
@@ -927,7 +927,9 @@ static int __ast_queue_frame(struct ast_channel *chan, struct ast_frame *fin, in
        AST_LIST_HEAD_INIT_NOLOCK(&frames);
        for (cur = fin; cur; cur = AST_LIST_NEXT(cur, frame_list)) {
                if (!(f = ast_frdup(cur))) {
-                       ast_frfree(AST_LIST_FIRST(&frames));
+                       if (AST_LIST_FIRST(&frames)) {
+                               ast_frfree(AST_LIST_FIRST(&frames));
+                       }
                        ast_channel_unlock(chan);
                        return -1;
                }