mirror of
https://github.com/mpv-player/mpv
synced 2025-02-17 04:58:06 +00:00
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:
parent
2e50d88ab2
commit
0f4d83ce51
@ -45,7 +45,7 @@ static int pngRead( unsigned char * fname,txSample * bf )
|
|||||||
fseek(fp, 0, SEEK_END);
|
fseek(fp, 0, SEEK_END);
|
||||||
len = ftell(fp);
|
len = ftell(fp);
|
||||||
if (len > 50 * 1024 * 1024) return 2;
|
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);
|
fseek(fp, 0, SEEK_SET);
|
||||||
fread(data, len, 1, fp);
|
fread(data, len, 1, fp);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
@ -74,6 +74,7 @@ static int pngRead( unsigned char * fname,txSample * bf )
|
|||||||
avcodec_close(avctx);
|
avcodec_close(avctx);
|
||||||
av_freep(&frame);
|
av_freep(&frame);
|
||||||
av_freep(&avctx);
|
av_freep(&avctx);
|
||||||
|
av_freep(&data);
|
||||||
|
|
||||||
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[png] filename: %s.\n",fname );
|
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 );
|
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[png] size: %dx%d bits: %d\n",bf->Width,bf->Height,bf->BPP );
|
||||||
|
Loading…
Reference in New Issue
Block a user