aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-11-04 01:06:45 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2021-10-09 22:02:19 +0200
commitde7f2908f1b759f0b2641391e3aa0ff972c61475 (patch)
tree730a604022871b249f9ecf0c9a0167eaae1d19a1
parent89e148cb81cfd94235be9da8ffd778a3f829646d (diff)
downloadffmpeg-de7f2908f1b759f0b2641391e3aa0ff972c61475.tar.gz
avformat/icodec: Factor failure code out in read_header()
Reviewed-by: Peter Ross <pross@xvid.org> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 27ee67c00f4402030af3b7477dd5088464d31d80) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/icodec.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/libavformat/icodec.c b/libavformat/icodec.c
index 49474566da..bd56b407c3 100644
--- a/libavformat/icodec.c
+++ b/libavformat/icodec.c
@@ -113,8 +113,7 @@ static int read_header(AVFormatContext *s)
ico->images[i].size = avio_rl32(pb);
if (ico->images[i].size <= 0) {
av_log(s, AV_LOG_ERROR, "Invalid image size %d\n", ico->images[i].size);
- av_freep(&ico->images);
- return AVERROR_INVALIDDATA;
+ goto fail;
}
ico->images[i].offset = avio_rl32(pb);
@@ -130,8 +129,7 @@ static int read_header(AVFormatContext *s)
break;
case 40:
if (ico->images[i].size < 40) {
- av_freep(&ico->images);
- return AVERROR_INVALIDDATA;
+ goto fail;
}
st->codecpar->codec_id = AV_CODEC_ID_BMP;
tmp = avio_rl32(pb);
@@ -143,12 +141,14 @@ static int read_header(AVFormatContext *s)
break;
default:
avpriv_request_sample(s, "codec %d", codec);
- av_freep(&ico->images);
- return AVERROR_INVALIDDATA;
+ goto fail;
}
}
return 0;
+fail:
+ av_freep(&ico->images);
+ return AVERROR_INVALIDDATA;
}
static int read_packet(AVFormatContext *s, AVPacket *pkt)