[MPlayer-cvslog] r36651 - trunk/stream/stream_dvdnav.c

reimar subversion at mplayerhq.hu
Sun Jan 19 23:24:46 CET 2014


Author: reimar
Date: Sun Jan 19 23:24:46 2014
New Revision: 36651

Log:
dvdnav: fix memory leaks in error paths.

Modified:
   trunk/stream/stream_dvdnav.c

Modified: trunk/stream/stream_dvdnav.c
==============================================================================
--- trunk/stream/stream_dvdnav.c	Sun Jan 19 23:24:45 2014	(r36650)
+++ trunk/stream/stream_dvdnav.c	Sun Jan 19 23:24:46 2014	(r36651)
@@ -107,18 +107,14 @@ static dvdnav_priv_t * new_dvdnav_stream
 
   dvd_set_speed(priv->filename, dvd_speed);
 
-  if(dvdnav_open(&(priv->dvdnav),priv->filename)!=DVDNAV_STATUS_OK)
+  if(dvdnav_open(&(priv->dvdnav),priv->filename)!=DVDNAV_STATUS_OK || !priv->dvdnav)
   {
+    dvd_set_speed(priv->filename, -1);
     free(priv->filename);
     free(priv);
     return NULL;
   }
 
-  if (!priv->dvdnav) {
-    free(priv);
-    return NULL;
-  }
-
   if(1)	//from vlc: if not used dvdnav from cvs will fail
   {
     int len, event;
@@ -622,6 +618,7 @@ static int open_s(stream_t *stream,int m
     priv->title = p->track;
     if(dvdnav_title_play(priv->dvdnav, p->track) != DVDNAV_STATUS_OK) {
       mp_msg(MSGT_OPEN,MSGL_FATAL,"dvdnav_stream, couldn't select title %d, error '%s'\n", p->track, dvdnav_err_to_string(priv->dvdnav));
+      stream_dvdnav_close(stream);
       return STREAM_UNSUPPORTED;
     }
     mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_DVD_CURRENT_TITLE=%d\n", p->track);


More information about the MPlayer-cvslog mailing list