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/library/md_wrap.c b/library/md_wrap.c
index 62110ce..ea0c1d2 100644
--- a/library/md_wrap.c
+++ b/library/md_wrap.c
@@ -396,7 +396,7 @@
static void * ripemd160_ctx_alloc( void )
{
ripemd160_context *ctx;
- ctx = (ripemd160_context *) polarssl_malloc( sizeof( ripemd160_context ) );
+ ctx = polarssl_malloc( sizeof( ripemd160_context ) );
if( ctx == NULL )
return( NULL );
@@ -492,7 +492,7 @@
static void * sha1_ctx_alloc( void )
{
sha1_context *ctx;
- ctx = (sha1_context *) polarssl_malloc( sizeof( sha1_context ) );
+ ctx = polarssl_malloc( sizeof( sha1_context ) );
if( ctx == NULL )
return( NULL );
@@ -701,7 +701,7 @@
static void * sha256_ctx_alloc( void )
{
sha256_context *ctx;
- ctx = (sha256_context *) polarssl_malloc( sizeof( sha256_context ) );
+ ctx = polarssl_malloc( sizeof( sha256_context ) );
if( ctx == NULL )
return( NULL );
@@ -907,7 +907,7 @@
static void * sha512_ctx_alloc( void )
{
sha512_context *ctx;
- ctx = (sha512_context *) polarssl_malloc( sizeof( sha512_context ) );
+ ctx = polarssl_malloc( sizeof( sha512_context ) );
if( ctx == NULL )
return( NULL );