# HG changeset patch # User philipjsg # Date 1020907467 0 # Node ID 02147e22f8c8fd5a6db81e1e1cf4f1069e95a3fe # Parent 3007abcbc510ad122ebdc59d876f528abbecaf6f * Don't allocate 0 bytes of memory. It upsets electricFence! diff -r 3007abcbc510 -r 02147e22f8c8 utils.c --- 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; }