Mercurial > libavcodec.hg
changeset 374:02147e22f8c8 libavcodec
* Don't allocate 0 bytes of memory. It upsets electricFence!
author | philipjsg |
---|---|
date | Thu, 09 May 2002 01:24:27 +0000 |
parents | 3007abcbc510 |
children | 749b5c16c0f7 |
files | utils.c |
diffstat | 1 files changed, 9 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/utils.c Thu May 09 01:23:49 2002 +0000 +++ b/utils.c Thu May 09 01:24:27 2002 +0000 @@ -71,12 +71,17 @@ 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; }