aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authormmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2009-06-23 15:08:27 +0000
committermmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2009-06-23 15:08:27 +0000
commitbffcd79a2b620a8b30f80174b677be9e4dbabbb7 (patch)
tree2bc4a555d6db4d592134350585fa93b2fcea72b9 /channels
parent3c0fb2cd2ea2dae7f95da88267fcaf01e4a5202e (diff)
Fix potential memory leak in chan_sip when video rtp is not allocated properly.
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@202572 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_sip.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index a1e627931..99b3d4f3c 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -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);