aboutsummaryrefslogtreecommitdiffstats
path: root/tools/ismindex.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-01-06 21:07:50 +0100
committerMichael Niedermayer <michaelni@gmx.at>2015-01-06 21:07:50 +0100
commita0a7b154bb49080d187170d0ed06e607fcc0b8d2 (patch)
tree13f176fe529a4dd69eddf060a3e43489a936fe58 /tools/ismindex.c
parentd2838f09d6dc788d382bb47dd6d6ef157a112ac4 (diff)
downloadffmpeg-a0a7b154bb49080d187170d0ed06e607fcc0b8d2.tar.gz
tools/ismindex: Keep count fields consistent with arrays in case of errors
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'tools/ismindex.c')
-rw-r--r--tools/ismindex.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/ismindex.c b/tools/ismindex.c
index 3e5304635f..d6386ac17d 100644
--- a/tools/ismindex.c
+++ b/tools/ismindex.c
@@ -340,6 +340,7 @@ static int read_tfra(struct Tracks *tracks, int start_index, AVIOContext *f)
track->chunks = avio_rb32(f);
track->offsets = av_mallocz_array(track->chunks, sizeof(*track->offsets));
if (!track->offsets) {
+ track->chunks = 0;
ret = AVERROR(ENOMEM);
goto fail;
}
@@ -448,10 +449,11 @@ fail:
static int get_private_data(struct Track *track, AVCodecContext *codec)
{
- track->codec_private_size = codec->extradata_size;
+ track->codec_private_size = 0;
track->codec_private = av_mallocz(codec->extradata_size);
if (!track->codec_private)
return AVERROR(ENOMEM);
+ track->codec_private_size = codec->extradata_size;
memcpy(track->codec_private, codec->extradata, codec->extradata_size);
return 0;
}