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/x509.c b/library/x509.c
index a3cb669..979878a 100644
--- a/library/x509.c
+++ b/library/x509.c
@@ -445,7 +445,7 @@
/* Mark this item as being only one in a set */
cur->next_merged = 1;
- cur->next = (x509_name *) polarssl_malloc( sizeof( x509_name ) );
+ cur->next = polarssl_malloc( sizeof( x509_name ) );
if( cur->next == NULL )
return( POLARSSL_ERR_X509_MALLOC_FAILED );
@@ -461,7 +461,7 @@
if( *p == end )
return( 0 );
- cur->next = (x509_name *) polarssl_malloc( sizeof( x509_name ) );
+ cur->next = polarssl_malloc( sizeof( x509_name ) );
if( cur->next == NULL )
return( POLARSSL_ERR_X509_MALLOC_FAILED );