[libdvdnav-devel] Check for malloc fail before setting secbuf
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:39 2015 -0700| [a3d569054c4e57d401137ba2e93d56afa5edd6d7] | committer: Jean-Baptiste Kempf
Check for malloc fail before setting secbuf
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/libdvdread.git/?a=commit;h=a3d569054c4e57d401137ba2e93d56afa5edd6d7
---
src/dvd_reader.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/dvd_reader.c b/src/dvd_reader.c
index 3dff649..e22412a 100644
--- a/src/dvd_reader.c
+++ b/src/dvd_reader.c
@@ -1323,12 +1323,12 @@ ssize_t DVDReadBytes( dvd_file_t *dvd_file, void *data, size_t byte_size )
( ( ( seek_byte + byte_size ) % DVD_VIDEO_LB_LEN ) ? 1 : 0 );
secbuf_base = malloc( numsec * DVD_VIDEO_LB_LEN + 2048 );
- secbuf = (unsigned char *)(((uintptr_t)secbuf_base & ~((uintptr_t)2047)) + 2048);
if( !secbuf_base ) {
fprintf( stderr, "libdvdread: Can't allocate memory "
"for file read!\n" );
return 0;
}
+ secbuf = (unsigned char *)(((uintptr_t)secbuf_base & ~((uintptr_t)2047)) + 2048);
if( dvd_file->dvd->isImageFile ) {
ret = DVDReadBlocksUDF( dvd_file, (uint32_t) seek_sector,
More information about the libdvdnav-devel
mailing list