[libdvdnav-devel] [PATCH 30/33] Check for malloc fail before setting buffer
beandog at gentoo.org
beandog at gentoo.org
Thu Jan 15 21:45:42 CET 2015
From: Steve Dibb <steve.dibb at gmail.com>
---
src/dvd_reader.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/dvd_reader.c b/src/dvd_reader.c
index a736ba6..66adfde 100644
--- a/src/dvd_reader.c
+++ b/src/dvd_reader.c
@@ -1445,7 +1445,6 @@ int DVDISOVolumeInfo( dvd_reader_t *dvd,
}
buffer_base = malloc( DVD_VIDEO_LB_LEN + 2048 );
- buffer = (unsigned char *)(((uintptr_t)buffer_base & ~((uintptr_t)2047)) + 2048);
if( buffer_base == NULL ) {
fprintf( stderr, "libdvdread: DVDISOVolumeInfo, failed to "
@@ -1453,6 +1452,8 @@ int DVDISOVolumeInfo( dvd_reader_t *dvd,
return -1;
}
+ buffer = (unsigned char *)(((uintptr_t)buffer_base & ~((uintptr_t)2047)) + 2048);
+
ret = InternalUDFReadBlocksRaw( dvd, 16, 1, buffer, 0 );
if( ret != 1 ) {
fprintf( stderr, "libdvdread: DVDISOVolumeInfo, failed to "
--
2.0.4
More information about the libdvdnav-devel
mailing list