mirror of https://github.com/mpv-player/mpv
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:
parent
bd83e685ec
commit
b850a6695d
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue