diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-03-14 12:02:43 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-03-14 12:15:02 +0100 |
commit | 905e7eb41389e4394e9c6e459b7d1a99dc30b075 (patch) | |
tree | 1d182a4e747144648ab74c4a7dfcc88395aa7c29 /tools/ismindex.c | |
parent | 360d71707f7d3b1c02be857515392a843f159b85 (diff) | |
parent | f099d3d1d5466bd63f4ab36270d169ff9ea613b8 (diff) | |
download | ffmpeg-905e7eb41389e4394e9c6e459b7d1a99dc30b075.tar.gz |
Merge commit 'f099d3d1d5466bd63f4ab36270d169ff9ea613b8'
* commit 'f099d3d1d5466bd63f4ab36270d169ff9ea613b8':
Add av_log_{ask_for_sample|missing_feature} replacements to libavutil
ismindex: Check the return value of allocations
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'tools/ismindex.c')
-rw-r--r-- | tools/ismindex.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/tools/ismindex.c b/tools/ismindex.c index 540aca2c68..502a7dc2b1 100644 --- a/tools/ismindex.c +++ b/tools/ismindex.c @@ -305,10 +305,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; |