Apply the semantic patch rm-malloc-cast.cocci.
for dir in library programs; do
spatch --sp-file scripts/rm-malloc-cast.cocci --dir $dir \
--in-place;
done
diff --git a/programs/test/ssl_test.c b/programs/test/ssl_test.c
index 63c3220..8ecd9c1 100644
--- a/programs/test/ssl_test.c
+++ b/programs/test/ssl_test.c
@@ -295,8 +295,8 @@
}
}
- read_buf = (unsigned char *) polarssl_malloc( opt->buffer_size );
- write_buf = (unsigned char *) polarssl_malloc( opt->buffer_size );
+ read_buf = polarssl_malloc( opt->buffer_size );
+ write_buf = polarssl_malloc( opt->buffer_size );
if( read_buf == NULL || write_buf == NULL )
{
diff --git a/programs/util/pem2der.c b/programs/util/pem2der.c
index 74f7a3e..50ec94b 100644
--- a/programs/util/pem2der.c
+++ b/programs/util/pem2der.c
@@ -129,7 +129,7 @@
*n = (size_t) size;
if( *n + 1 == 0 ||
- ( *buf = (unsigned char *) polarssl_malloc( *n + 1 ) ) == NULL )
+ ( *buf = polarssl_malloc( *n + 1 ) ) == NULL )
{
fclose( f );
return( -1 );