mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-21 10:55:51 +02:00
* Don't allocate 0 bytes of memory. It upsets electricFence!
Originally committed as revision 472 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
8170f3dc8f
commit
0edf8a7a65
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user