[libdvdnav-devel] Check for malloc fail before setting buffer
Steve Dibb
git at videolan.org
Wed Jan 21 17:24:24 CET 2015
libdvdread | branch: master | Steve Dibb <steve.dibb at gmail.com> | Thu Jan 15 13:45:42 2015 -0700| [f5ea91421d7912bffc8c5964409fd4454f1f5985] | committer: Jean-Baptiste Kempf
Check for malloc fail before setting buffer
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/libdvdread.git/?a=commit;h=f5ea91421d7912bffc8c5964409fd4454f1f5985
---
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 72dc54a..e3660dd 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 "
More information about the libdvdnav-devel
mailing list