diff options
author | Nicolas George <george@nsup.org> | 2013-12-29 10:42:54 +0100 |
---|---|---|
committer | Nicolas George <george@nsup.org> | 2013-12-30 10:58:01 +0100 |
commit | 38004051b53ddecb518053e6dadafa9adc4fc1b2 (patch) | |
tree | 33b4f05c6eaf1a699c9e166651b25ae95ef6b6b8 | |
parent | a55692a96099c40aabb25e1443890be99f9c845c (diff) | |
download | ffmpeg-38004051b53ddecb518053e6dadafa9adc4fc1b2.tar.gz |
lavc/utils: check av_frame_alloc() failure.
-rw-r--r-- | libavcodec/utils.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index c000d27155..f6601332ce 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -1721,6 +1721,8 @@ int attribute_align_arg avcodec_encode_audio(AVCodecContext *avctx, if (samples) { frame = av_frame_alloc(); + if (!frame) + return AVERROR(ENOMEM); if (avctx->frame_size) { frame->nb_samples = avctx->frame_size; @@ -2158,6 +2160,8 @@ int attribute_align_arg avcodec_decode_audio3(AVCodecContext *avctx, int16_t *sa AVFrame *frame = av_frame_alloc(); int ret, got_frame = 0; + if (!frame) + return AVERROR(ENOMEM); if (avctx->get_buffer != avcodec_default_get_buffer) { av_log(avctx, AV_LOG_ERROR, "Custom get_buffer() for use with" "avcodec_decode_audio3() detected. Overriding with avcodec_default_get_buffer\n"); |