]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fix potential memory leak in chan_sip when video rtp is not allocated properly.
authorMark Michelson <mmichelson@digium.com>
Tue, 23 Jun 2009 15:08:27 +0000 (15:08 +0000)
committerMark Michelson <mmichelson@digium.com>
Tue, 23 Jun 2009 15:08:27 +0000 (15:08 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@202572 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index a1e6279319ef5c4b8014c8d1eb85625949707955..99b3d4f3c35c78d2c0ccb0ed4c57b8e1d87bc0e0 100644 (file)
@@ -4600,6 +4600,10 @@ static struct sip_pvt *sip_alloc(ast_string_field callid, struct sockaddr_in *si
                if (!p->rtp || (ast_test_flag(&p->flags[1], SIP_PAGE2_VIDEOSUPPORT) && !p->vrtp)) {
                        ast_log(LOG_WARNING, "Unable to create RTP audio %s session: %s\n",
                                ast_test_flag(&p->flags[1], SIP_PAGE2_VIDEOSUPPORT) ? "and video" : "", strerror(errno));
+                       /* If rtp was successfully allocated, but vrtp was not, then we need to be sure to free rtp here */
+                       if (p->rtp) {
+                               ast_rtp_destroy(p->rtp);
+                       }
                        ast_mutex_destroy(&p->lock);
                        if (p->chanvars) {
                                ast_variables_destroy(p->chanvars);