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/ssl_cache.c b/library/ssl_cache.c
index 30da95a..7519f36 100644
--- a/library/ssl_cache.c
+++ b/library/ssl_cache.c
@@ -103,7 +103,7 @@
*/
if( entry->peer_cert.p != NULL )
{
- if( ( session->peer_cert = (x509_crt *) polarssl_malloc(
+ if( ( session->peer_cert = polarssl_malloc(
sizeof(x509_crt) ) ) == NULL )
{
ret = 1;
@@ -222,7 +222,7 @@
/*
* max_entries not reached, create new entry
*/
- cur = (ssl_cache_entry *) polarssl_malloc( sizeof(ssl_cache_entry) );
+ cur = polarssl_malloc( sizeof(ssl_cache_entry) );
if( cur == NULL )
{
ret = 1;
@@ -259,7 +259,7 @@
*/
if( session->peer_cert != NULL )
{
- cur->peer_cert.p = (unsigned char *) polarssl_malloc(
+ cur->peer_cert.p = polarssl_malloc(
session->peer_cert->raw.len );
if( cur->peer_cert.p == NULL )
{