comparison utils.c @ 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 1ee4ba4ca783
children 47c878305986
comparison
equal deleted inserted replaced
373:3007abcbc510 374:02147e22f8c8
69 { 69 {
70 int ret; 70 int ret;
71 71
72 avctx->codec = codec; 72 avctx->codec = codec;
73 avctx->frame_number = 0; 73 avctx->frame_number = 0;
74 avctx->priv_data = av_mallocz(codec->priv_data_size); 74 if (codec->priv_data_size > 0) {
75 if (!avctx->priv_data) 75 avctx->priv_data = av_mallocz(codec->priv_data_size);
76 return -ENOMEM; 76 if (!avctx->priv_data)
77 return -ENOMEM;
78 } else {
79 avctx->priv_data = NULL;
80 }
77 ret = avctx->codec->init(avctx); 81 ret = avctx->codec->init(avctx);
78 if (ret < 0) { 82 if (ret < 0) {
79 free(avctx->priv_data); 83 if (avctx->priv_data)
84 free(avctx->priv_data);
80 avctx->priv_data = NULL; 85 avctx->priv_data = NULL;
81 return ret; 86 return ret;
82 } 87 }
83 return 0; 88 return 0;
84 } 89 }