aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Converse <alex.converse@gmail.com>2011-08-30 15:57:50 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-08-30 18:08:23 +0200
commitcb1343854308de5db240697734dc6542c1587fc0 (patch)
treeb5e8743c729074a6d3926c7331468a4beffd9b30
parent6e6ccf0d56d81f4bb0472c3974e10e620fcffa04 (diff)
downloadffmpeg-cb1343854308de5db240697734dc6542c1587fc0.tar.gz
ffmpeg: Set error code before before jumping to fail.
-rw-r--r--ffmpeg.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index 824ea8bf66..f0374f7000 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1971,8 +1971,10 @@ static int transcode(OutputFile *output_files,
if (ost->st->stream_copy) {
uint64_t extra_size = (uint64_t)icodec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE;
- if (extra_size > INT_MAX)
+ if (extra_size > INT_MAX) {
+ ret = AVERROR(EINVAL);
goto fail;
+ }
/* if stream_copy is selected, no need to decode or encode */
codec->codec_id = icodec->codec_id;
@@ -1989,8 +1991,10 @@ static int transcode(OutputFile *output_files,
codec->rc_max_rate = icodec->rc_max_rate;
codec->rc_buffer_size = icodec->rc_buffer_size;
codec->extradata= av_mallocz(extra_size);
- if (!codec->extradata)
+ if (!codec->extradata) {
+ ret = AVERROR(ENOMEM);
goto fail;
+ }
memcpy(codec->extradata, icodec->extradata, icodec->extradata_size);
codec->extradata_size= icodec->extradata_size;
@@ -2055,8 +2059,10 @@ static int transcode(OutputFile *output_files,
switch(codec->codec_type) {
case AVMEDIA_TYPE_AUDIO:
ost->fifo= av_fifo_alloc(1024);
- if(!ost->fifo)
+ if (!ost->fifo) {
+ ret = AVERROR(ENOMEM);
goto fail;
+ }
ost->reformat_pair = MAKE_SFMT_PAIR(AV_SAMPLE_FMT_NONE,AV_SAMPLE_FMT_NONE);
if (!codec->sample_rate) {
codec->sample_rate = icodec->sample_rate;