shithub: libdvdcss

Download patch

ref: ca926c62869bbb9079a2ddc1af5f7f08f356dd9b
parent: 31bf1942f771409e9375a4daf8a53b309cd3a088
author: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
date: Tue Nov 6 13:15:08 EST 2012

Use calloc instead of malloc+memset.

Besides being simpler, it fixes the malloc failure
checks which currently are useless since we would
crash in memset first.


--- a/src/css.c
+++ b/src/css.c
@@ -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 );