aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-08-27 10:15:51 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-08-31 17:01:38 +0200
commitfea4f953b5c6e04b84ce9c11664c9cbcac171a60 (patch)
tree5edeb0d2756ef419fe55eaad2adcbfe7637b6da9
parentbcbd84f435f5f449c04f93023eb874e07c76470c (diff)
downloadffmpeg-fea4f953b5c6e04b84ce9c11664c9cbcac171a60.tar.gz
avformat/utils: Use av_memdup to duplicate array of AVChapter *
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r--libavformat/utils.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index b3ff9e95eb..b56190d2da 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3176,12 +3176,9 @@ static int compute_chapters_end(AVFormatContext *s)
max_time = s->duration +
((s->start_time == AV_NOPTS_VALUE) ? 0 : s->start_time);
- timetable = av_malloc(s->nb_chapters * sizeof(*timetable));
+ timetable = av_memdup(s->chapters, s->nb_chapters * sizeof(*timetable));
if (!timetable)
return AVERROR(ENOMEM);
-
- for (i = 0; i < s->nb_chapters; i++)
- timetable[i] = s->chapters[i];
qsort(timetable, s->nb_chapters, sizeof(*timetable), chapter_start_cmp);
for (i = 0; i < s->nb_chapters; i++)