[DVDnav-discuss] r985 - trunk/libdvdnav/src/dvdread/dvd_reader.c

nicodvb subversion at mplayerhq.hu
Mon Dec 31 18:44:05 CET 2007


Author: nicodvb
Date: Mon Dec 31 18:44:05 2007
New Revision: 985

Log:
call dvdinput_close() after having successfully opened it but before exiting in case of errors; part of ogle-1778

Modified:
   trunk/libdvdnav/src/dvdread/dvd_reader.c

Modified: trunk/libdvdnav/src/dvdread/dvd_reader.c
==============================================================================
--- trunk/libdvdnav/src/dvdread/dvd_reader.c	(original)
+++ trunk/libdvdnav/src/dvdread/dvd_reader.c	Mon Dec 31 18:44:05 2007
@@ -231,7 +231,10 @@ static dvd_reader_t *DVDOpenImageFile( c
     }
 
     dvd = (dvd_reader_t *) malloc( sizeof( dvd_reader_t ) );
-    if( !dvd ) return NULL;
+    if( !dvd ) {
+        dvdinput_close(dev);
+        return NULL;
+    }
     dvd->isImageFile = 1;
     dvd->dev = dev;
     dvd->path_root = 0;
@@ -653,6 +656,7 @@ static dvd_file_t *DVDOpenFilePath( dvd_
     dvd_file = (dvd_file_t *) malloc( sizeof( dvd_file_t ) );
     if( !dvd_file ) {
       fprintf( stderr, "libdvdnav:DVDOpenFilePath:dvd_file malloc failed\n" );
+      dvdinput_close(dev);
       return NULL;
     }
     dvd_file->dvd = dvd;
@@ -762,6 +766,7 @@ static dvd_file_t *DVDOpenVOBPath( dvd_r
 
         if( stat( full_path, &fileinfo ) < 0 ) {
             fprintf( stderr, "libdvdread: Can't stat() %s.\n", filename );
+            dvdinput_close(dev);
             free( dvd_file );
             return NULL;
         }



More information about the DVDnav-discuss mailing list