Ticket #4670: fix-possible-dvd-file-leak-in-dvdnav-dvd_reader.patch

File fix-possible-dvd-file-leak-in-dvdnav-dvd_reader.patch, 926 bytes (added by Erik Hovland <erik@…>, 13 years ago)
  • libs/libmythdvdnav/dvd_reader.c

    dvd_reader.c does not close the dvd file struct if it cannot allocate
    
    From: Erik Hovland <erik@hovland.org>
    
    enough memory to read in the file. This is a minor leak and likely
    to not be detrimental since it will close the program at this
    point. But you can never be too careful.
    
    This patch adds the needed close.
    ---
    
     libs/libmythdvdnav/dvd_reader.c |    1 +
     1 files changed, 1 insertions(+), 0 deletions(-)
    
    diff --git a/libs/libmythdvdnav/dvd_reader.c b/libs/libmythdvdnav/dvd_reader.c
    index 3a448b5..f44bbab 100644
    a b int DVDDiscID( dvd_reader_t *dvd, unsigned char *discid ) 
    10971097            if( buffer_base == NULL ) {
    10981098                fprintf( stderr, "libdvdread: DVDDiscId, failed to "
    10991099                         "allocate memory for file read!\n" );
     1100                DVDCloseFile( dvd_file );
    11001101                return -1;
    11011102            }
    11021103            bytes_read = DVDReadBytes( dvd_file, buffer, file_size );