[libdvdcss-devel] [PATCH] replace malloc+memset with calloc.

Reimar Döffinger Reimar.Doeffinger at gmx.de
Tue Nov 6 18:59:07 CET 2012


Hello,
this also fixes the fairly nonsense NULL checks that are done after we
would have crashed in memset...
Index: src/css.c
===================================================================
--- src/css.c	(revision 255)
+++ src/css.c	(working copy)
@@ -1163,8 +1163,7 @@
      */
 
     /* initialize lookup tables for k[1] */
-    K1table = malloc( 65536 * K1TABLEWIDTH );
-    memset( K1table, 0 , 65536 * K1TABLEWIDTH );
+    K1table = calloc( 65536, K1TABLEWIDTH );
     if( K1table == NULL )
     {
         return -1;
@@ -1195,8 +1194,7 @@
     }
 
     /* Initing our Really big table */
-    BigTable = malloc( 16777216 * sizeof(int) );
-    memset( BigTable, 0 , 16777216 * sizeof(int) );
+    BigTable = calloc( 16777216, sizeof(int) );
     if( BigTable == NULL )
     {
         free( K1table );



More information about the libdvdcss-devel mailing list