Commit 4abf6fa0 authored by Martin Storsjö's avatar Martin Storsjö

ismindex: Check the return value of allocations

Signed-off-by: 's avatarMartin Storsjö <martin@martin.st>
parent 7c147900
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment