[libdvdcss-devel] [PATCH 29/47] css: Check the return value of a malloc() invocation

Diego Biurrun <[email protected]>
Newsgroups gmane.comp.video.videolan.libdvdcss,gmane.comp.video.videolan.libdvdcss.devel
Message-ID <[email protected]>
This prevents a possible NULL pointer dereference further along.
---
 src/css.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/css.c b/src/css.c
index 3d73080..90957d5 100644
--- a/src/css.c
+++ b/src/css.c
@@ -297,6 +297,10 @@ int dvdcss_title ( dvdcss_t dvdcss, int i_block )
 
     /* Write in the new title and its key */
     p_newtitle = malloc( sizeof( dvd_title_t ) );
+    if( p_newtitle == NULL )
+    {
+        return -1;
+    }
     p_newtitle->i_startlb = i_block;
     memcpy( p_newtitle->p_key, p_title_key, KEY_SIZE );
 
-- 
1.9.1

_______________________________________________
libdvdcss-devel mailing list
[email protected]
https://mailman.videolan.org/listinfo/libdvdcss-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.