[FFmpeg-cvslog] ismindex: Check the return value of allocations
Martin Storsjö
git at videolan.org
Thu Mar 14 12:23:31 CET 2013
ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Wed Mar 13 14:13:46 2013 +0200| [4abf6fa095f8082499d5a24cdfb18eb4c1fec60e] | committer: Martin Storsjö
ismindex: Check the return value of allocations
Signed-off-by: Martin Storsjö <martin at martin.st>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4abf6fa095f8082499d5a24cdfb18eb4c1fec60e
---
tools/ismindex.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/tools/ismindex.c b/tools/ismindex.c
index 89b33e5..ad1f3a8 100644
--- a/tools/ismindex.c
+++ b/tools/ismindex.c
@@ -300,10 +300,21 @@ static int handle_file(struct Tracks *tracks, const char *file, int split)
tracks->duration = ctx->duration;
for (i = 0; i < ctx->nb_streams; i++) {
+ struct Track **temp;
AVStream *st = ctx->streams[i];
track = av_mallocz(sizeof(*track));
- tracks->tracks = av_realloc(tracks->tracks,
- sizeof(*tracks->tracks) * (tracks->nb_tracks + 1));
+ if (!track) {
+ err = AVERROR(ENOMEM);
+ goto fail;
+ }
+ temp = av_realloc(tracks->tracks,
+ sizeof(*tracks->tracks) * (tracks->nb_tracks + 1));
+ if (!temp) {
+ av_free(track);
+ err = AVERROR(ENOMEM);
+ goto fail;
+ }
+ tracks->tracks = temp;
tracks->tracks[tracks->nb_tracks] = track;
track->name = file;
More information about the ffmpeg-cvslog
mailing list