wmail: use calloc, instead of malloc + memset.

This commit is contained in:
Jeremy Sowden 2019-05-27 22:52:09 +01:00 committed by Carlos R. Mafra
parent 9f0821af1f
commit 49def3a155

View file

@ -897,24 +897,20 @@ char *ParseFromField( char *buf )
int maxLen = strlen( buf ) + 1;
char *comment;
if(( fullName = malloc( maxLen )) == NULL )
if(( fullName = calloc( maxLen, sizeof *fullName )) == NULL )
return NULL;
if(( addressName = malloc( maxLen )) == NULL )
if(( addressName = calloc( maxLen, sizeof *addressName )) == NULL )
{
free( fullName );
return NULL;
}
if(( comment = malloc( maxLen )) == NULL )
if(( comment = calloc( maxLen, sizeof *comment )) == NULL )
{
free( fullName );
free( addressName );
return NULL;
}
memset( fullName, '\0', maxLen );
memset( addressName, '\0', maxLen );
memset( comment, '\0', maxLen );
// FIXME: Don't do that "encoded" dance. It's not intended by
// RFC2047, and it's better to just do it in the end.
// Cleaner.