Make sure some value is always returned via data_size

Originally committed as revision 12955 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Michel Bardiaux 2008-04-25 13:25:11 +00:00
parent 3b8c000d1e
commit 202aca676f
1 changed files with 2 additions and 3 deletions

View File

@ -121,9 +121,8 @@ AVCodec libgsm_ms_encoder = {
static int libgsm_decode_frame(AVCodecContext *avctx, static int libgsm_decode_frame(AVCodecContext *avctx,
void *data, int *data_size, void *data, int *data_size,
uint8_t *buf, int buf_size) { uint8_t *buf, int buf_size) {
*data_size = 0; /* In case of error */
if(buf_size < avctx->block_align) return 0; if(buf_size < avctx->block_align) return -1;
switch(avctx->codec_id) { switch(avctx->codec_id) {
case CODEC_ID_GSM: case CODEC_ID_GSM:
if(gsm_decode(avctx->priv_data,buf,data)) return -1; if(gsm_decode(avctx->priv_data,buf,data)) return -1;