Use av_malloc to ensure sufficient alignment and also free at least some

of the allocated memory.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30430 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2010-01-24 21:15:43 +00:00
parent 2e50d88ab2
commit 0f4d83ce51
1 changed files with 2 additions and 1 deletions

View File

@ -45,7 +45,7 @@ static int pngRead( unsigned char * fname,txSample * bf )
fseek(fp, 0, SEEK_END);
len = ftell(fp);
if (len > 50 * 1024 * 1024) return 2;
data = malloc(len + FF_INPUT_BUFFER_PADDING_SIZE);
data = av_malloc(len + FF_INPUT_BUFFER_PADDING_SIZE);
fseek(fp, 0, SEEK_SET);
fread(data, len, 1, fp);
fclose(fp);
@ -74,6 +74,7 @@ static int pngRead( unsigned char * fname,txSample * bf )
avcodec_close(avctx);
av_freep(&frame);
av_freep(&avctx);
av_freep(&data);
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[png] filename: %s.\n",fname );
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[png] size: %dx%d bits: %d\n",bf->Width,bf->Height,bf->BPP );