mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-08 13:22:53 +02:00
ismindex: Check the return value of allocations
Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
parent
7c147900b8
commit
4abf6fa095
@ -300,10 +300,21 @@ static int handle_file(struct Tracks *tracks, const char *file, int split)
|
|||||||
tracks->duration = ctx->duration;
|
tracks->duration = ctx->duration;
|
||||||
|
|
||||||
for (i = 0; i < ctx->nb_streams; i++) {
|
for (i = 0; i < ctx->nb_streams; i++) {
|
||||||
|
struct Track **temp;
|
||||||
AVStream *st = ctx->streams[i];
|
AVStream *st = ctx->streams[i];
|
||||||
track = av_mallocz(sizeof(*track));
|
track = av_mallocz(sizeof(*track));
|
||||||
tracks->tracks = av_realloc(tracks->tracks,
|
if (!track) {
|
||||||
sizeof(*tracks->tracks) * (tracks->nb_tracks + 1));
|
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;
|
tracks->tracks[tracks->nb_tracks] = track;
|
||||||
|
|
||||||
track->name = file;
|
track->name = file;
|
||||||
|
Loading…
Reference in New Issue
Block a user