]> git.sesse.net Git - ffmpeg/commitdiff
RTSP: Clean up rtsp_hd on failure
authorMartin Storsjö <martin@martin.st>
Fri, 18 Jun 2010 17:54:56 +0000 (17:54 +0000)
committerMartin Storsjö <martin@martin.st>
Fri, 18 Jun 2010 17:54:56 +0000 (17:54 +0000)
Since rtsp_hd isn't assigned to rt->rtsp_hd until after the setup phase,
the initialized URLContext could be leaked on failures.

Originally committed as revision 23643 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavformat/rtsp.c

index e762f61e8910f4b21db3df37f999b3eb94252428..6507841cdb514d8f5b956724162effef8bf5d5a0 100644 (file)
@@ -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;
         }