diff options
author | Paul B Mahol <onemda@gmail.com> | 2012-01-28 23:46:47 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-01-29 01:08:20 +0400 |
commit | 3ac99cdc412f3c02f96c752a6da4aada10f2edb6 (patch) | |
tree | 99713f5d10fe73a881c82e4b14413014d9b9abd8 /libavcodec/libgsm.c | |
parent | 47a5274104cf1b0a33c3405aa6e2842fe4aea46d (diff) |
libgsm: check return value of gsm_create & avcodec_alloc_frame()
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/libgsm.c')
-rw-r--r-- | libavcodec/libgsm.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libavcodec/libgsm.c b/libavcodec/libgsm.c index 23950c0c21..203e360375 100644 --- a/libavcodec/libgsm.c +++ b/libavcodec/libgsm.c @@ -55,6 +55,8 @@ static av_cold int libgsm_encode_init(AVCodecContext *avctx) { } avctx->priv_data = gsm_create(); + if (!avctx->priv_data) + goto error; switch(avctx->codec_id) { case CODEC_ID_GSM: @@ -71,8 +73,13 @@ static av_cold int libgsm_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: + libgsm_encode_close(); + return -1; } static av_cold int libgsm_encode_close(AVCodecContext *avctx) { |