Mercurial > libdvdnav.hg
changeset 325:d61d2dd248b2 src
call dvdinput_close() after having successfully opened it but before exiting in case of errors; part of ogle-1778
author | nicodvb |
---|---|
date | Mon, 31 Dec 2007 17:44:05 +0000 |
parents | f59175f21e06 |
children | c1d5abe51fda |
files | dvdread/dvd_reader.c |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/dvdread/dvd_reader.c Mon Dec 31 17:25:55 2007 +0000 +++ b/dvdread/dvd_reader.c Mon Dec 31 17:44:05 2007 +0000 @@ -231,7 +231,10 @@ } 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 @@ 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 @@ if( stat( full_path, &fileinfo ) < 0 ) { fprintf( stderr, "libdvdread: Can't stat() %s.\n", filename ); + dvdinput_close(dev); free( dvd_file ); return NULL; }