Use calloc instead of malloc+memset

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23218 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2007-05-02 16:42:31 +00:00
parent bd83e685ec
commit b850a6695d
1 changed files with 1 additions and 2 deletions

View File

@ -74,13 +74,12 @@ static int conv24to32( txSample * bf )
tmpImage=bf->Image; tmpImage=bf->Image;
bf->ImageSize=bf->Width * bf->Height * 4; bf->ImageSize=bf->Width * bf->Height * 4;
bf->BPP=32; bf->BPP=32;
if ( ( bf->Image=malloc( bf->ImageSize ) ) == NULL ) if ( ( bf->Image=calloc( 1, bf->ImageSize ) ) == NULL )
{ {
free( tmpImage ); free( tmpImage );
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bitmap] not enough memory for image\n" ); mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bitmap] not enough memory for image\n" );
return 1; return 1;
} }
memset( bf->Image,0,bf->ImageSize );
for ( c=0,i=0; c < bf->ImageSize; ) for ( c=0,i=0; c < bf->ImageSize; )
{ {
bf->Image[c++]=tmpImage[i++]; //red bf->Image[c++]=tmpImage[i++]; //red