]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
chan_sip: Clean leak on error path of process_sdp
authorCorey Farrell <git@cfware.com>
Sun, 5 Oct 2014 00:25:01 +0000 (00:25 +0000)
committerCorey Farrell <git@cfware.com>
Sun, 5 Oct 2014 00:25:01 +0000 (00:25 +0000)
Resolve leak in process_sdp that occurs in 2 error path's where
crypto lines are expected but not provided.

ASTERISK-24385 #close
Reported by: Corey Farrell
Review: https://reviewboard.asterisk.org/r/4045/
........

Merged revisions 424569 from http://svn.asterisk.org/svn/asterisk/branches/11

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

channels/chan_sip.c

index 8d3816ec02366bf0add5d8367e95c9e5dc1c0f9c..ac7d02f1e686fc5954532fe8538bf662131359ea 100644 (file)
@@ -10488,10 +10488,12 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
                /* Ensure crypto lines are provided where necessary */
                if (audio && secure_audio && !processed_crypto) {
                        ast_log(LOG_WARNING, "Rejecting secure audio stream without encryption details: %s\n", m);
-                       return -1;
+                       res = -1;
+                       goto process_sdp_cleanup_b;
                } else if (video && secure_video && !processed_crypto) {
                        ast_log(LOG_WARNING, "Rejecting secure video stream without encryption details: %s\n", m);
-                       return -1;
+                       res = -1;
+                       goto process_sdp_cleanup_b;
                }
        }
 
@@ -10802,6 +10804,8 @@ process_sdp_cleanup:
        if (res) {
                offered_media_list_destroy(p);
        }
+
+process_sdp_cleanup_b:
        ast_rtp_codecs_payloads_destroy(&newtextrtp);
        ast_rtp_codecs_payloads_destroy(&newvideortp);
        ast_rtp_codecs_payloads_destroy(&newaudiortp);