Discussion:
[libdvdcss-devel] [PATCH] replace malloc+memset with calloc.
Reimar Döffinger
2012-11-06 17:59:07 UTC
Permalink
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 );
Jean-Baptiste Kempf
2012-11-06 18:01:18 UTC
Permalink
Post by Reimar Döffinger
this also fixes the fairly nonsense NULL checks that are done after we
would have crashed in memset...
OK to push for me.

Best regards,
--
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
Reimar Döffinger
2012-11-06 18:17:37 UTC
Permalink
Post by Jean-Baptiste Kempf
Post by Reimar Döffinger
this also fixes the fairly nonsense NULL checks that are done after we
would have crashed in memset...
OK to push for me.
Thanks, done.
Jean-Baptiste Kempf
2012-11-06 19:10:53 UTC
Permalink
Post by Reimar Döffinger
Post by Jean-Baptiste Kempf
Post by Reimar Döffinger
this also fixes the fairly nonsense NULL checks that are done after we
would have crashed in memset...
OK to push for me.
Thanks, done.
To be honest, for such obvious fixes, I don't think you need to send on
the mailing list first... :)

Best regards,
--
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
Loading...