[FFmpeg-devel] [PATCH] adpcmenc: check return value of avcodec_alloc_frame()
Paul B Mahol
onemda at gmail.com
Sat Jan 28 20:06:08 CET 2012
Also refactor some code while here.
Signed-off-by: Paul B Mahol <onemda at gmail.com>
---
libavcodec/adpcmenc.c | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/libavcodec/adpcmenc.c b/libavcodec/adpcmenc.c
index e500a1c..a0cd806 100644
--- a/libavcodec/adpcmenc.c
+++ b/libavcodec/adpcmenc.c
@@ -137,14 +137,12 @@ static av_cold int adpcm_encode_init(AVCodecContext *avctx)
}
avctx->coded_frame = avcodec_alloc_frame();
- avctx->coded_frame->key_frame= 1;
+ if (!avctx->coded_frame)
+ goto error;
return 0;
error:
- av_freep(&s->paths);
- av_freep(&s->node_buf);
- av_freep(&s->nodep_buf);
- av_freep(&s->trellis_hash);
+ adpcm_encode_close(avctx);
return -1;
}
--
1.7.7
More information about the ffmpeg-devel
mailing list