diff options
author | Philip Gladstone <philipjsg@users.sourceforge.net> | 2002-05-09 01:24:27 +0000 |
---|---|---|
committer | Philip Gladstone <philipjsg@users.sourceforge.net> | 2002-05-09 01:24:27 +0000 |
commit | 0edf8a7a657f096945f6c234f39fbebdba833146 (patch) | |
tree | 2cca174eaa5775a19cd2c24f3853095ce372764a /libavcodec/utils.c | |
parent | 8170f3dc8fb8a63e00c71363ae0c5527baa04828 (diff) | |
download | ffmpeg-0edf8a7a657f096945f6c234f39fbebdba833146.tar.gz |
* Don't allocate 0 bytes of memory. It upsets electricFence!
Originally committed as revision 472 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r-- | libavcodec/utils.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 441b8f151f..0f80b1b9b3 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -71,12 +71,17 @@ int avcodec_open(AVCodecContext *avctx, AVCodec *codec) avctx->codec = codec; avctx->frame_number = 0; - avctx->priv_data = av_mallocz(codec->priv_data_size); - if (!avctx->priv_data) - return -ENOMEM; + if (codec->priv_data_size > 0) { + avctx->priv_data = av_mallocz(codec->priv_data_size); + if (!avctx->priv_data) + return -ENOMEM; + } else { + avctx->priv_data = NULL; + } ret = avctx->codec->init(avctx); if (ret < 0) { - free(avctx->priv_data); + if (avctx->priv_data) + free(avctx->priv_data); avctx->priv_data = NULL; return ret; } |