wmail: use calloc, instead of malloc + memset.
This commit is contained in:
		
							parent
							
								
									9f0821af1f
								
							
						
					
					
						commit
						49def3a155
					
				
					 1 changed files with 3 additions and 7 deletions
				
			
		| 
						 | 
					@ -897,24 +897,20 @@ char *ParseFromField( char *buf )
 | 
				
			||||||
    int maxLen = strlen( buf ) + 1;
 | 
					    int maxLen = strlen( buf ) + 1;
 | 
				
			||||||
    char *comment;
 | 
					    char *comment;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if(( fullName = malloc( maxLen )) == NULL )
 | 
					    if(( fullName = calloc( maxLen, sizeof *fullName )) == NULL )
 | 
				
			||||||
	return NULL;
 | 
						return NULL;
 | 
				
			||||||
    if(( addressName = malloc( maxLen )) == NULL )
 | 
					    if(( addressName = calloc( maxLen, sizeof *addressName )) == NULL )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
	free( fullName );
 | 
						free( fullName );
 | 
				
			||||||
	return NULL;
 | 
						return NULL;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if(( comment = malloc( maxLen )) == NULL )
 | 
					    if(( comment = calloc( maxLen, sizeof *comment )) == NULL )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
	free( fullName );
 | 
						free( fullName );
 | 
				
			||||||
	free( addressName );
 | 
						free( addressName );
 | 
				
			||||||
	return NULL;
 | 
						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
 | 
					    // FIXME: Don't do that "encoded" dance.  It's not intended by
 | 
				
			||||||
    // RFC2047, and it's better to just do it in the end.
 | 
					    // RFC2047, and it's better to just do it in the end.
 | 
				
			||||||
    // Cleaner.
 | 
					    // Cleaner.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue