changeset 30388:45dcf93d41fa

Use av_malloc to ensure sufficient alignment and also free at least some of the allocated memory.
author reimar
date Sun, 24 Jan 2010 21:15:43 +0000
parents 30d6f38357c7
children da75265e5b6f
files gui/bitmap.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/gui/bitmap.c	Sun Jan 24 20:54:17 2010 +0000
+++ b/gui/bitmap.c	Sun Jan 24 21:15:43 2010 +0000
@@ -45,7 +45,7 @@
  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 @@
  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 );