Hi,

I noticed that the GET URLContext can be leaked if some of the later 
operations fail before assigning the handles to rt->rtsp_hd{,_out}. This 
patch should fix the issue.

Josh, do you think this is ok, or would you rather assign the handles 
directly to rt->rtsp_hd without using the local variables?

// Martin
From f0d0e378c9d1f8965189c9760a3e5039d06d4eec Mon Sep 17 00:00:00 2001
From: Martin Storsjo <[email protected]>
Date: Fri, 18 Jun 2010 10:40:51 +0300
Subject: [PATCH] RTSP: Clean up rtsp_hd on failure

Since rtsp_hd isn't assigned to rt->rtsp_hd until after the setup phase,
the initialized URLContext could be leaked on failures.
---
 libavformat/rtsp.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index e762f61..6507841 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1594,12 +1594,14 @@ redirect:
 
         /* complete the connection */
         if (url_read(rtsp_hd, NULL, 0)) {
+            url_close(rtsp_hd);
             err = AVERROR(EIO);
             goto fail;
         }
 
         /* POST requests */
         if (url_open(&rtsp_hd_out, httpname, URL_WRONLY) < 0 ) {
+            url_close(rtsp_hd);
             err = AVERROR(EIO);
             goto fail;
         }
-- 
1.7.1

_______________________________________________
FFmpeg-soc mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-soc

Reply via email to