aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas George <george@nsup.org>2013-12-29 10:42:54 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-01-07 21:28:41 +0100
commit4d70639d536da0574abeffc792d8f36e1fa62655 (patch)
tree3c0b048c11de5817dc3f317a174abae6ec3eb126
parenta6ba0f7be91fcb4738d226b3b100a4750baf4340 (diff)
downloadffmpeg-4d70639d536da0574abeffc792d8f36e1fa62655.tar.gz
lavc/utils: check av_frame_alloc() failure.
(cherry picked from commit 38004051b53ddecb518053e6dadafa9adc4fc1b2) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/utils.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 38fc3d3c8c..25bb24580f 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1725,6 +1725,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;
@@ -2117,6 +2119,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");