lavf/concatdec: avoid leaking URLs.
Use av_realloc instead of av_realloc_f to keep the original array in case of failure: it is freed in full by the fail label.
This commit is contained in:
parent
75b3911e5a
commit
16c3cb9bbf
@ -69,9 +69,11 @@ static int add_file(AVFormatContext *avf, char *filename, ConcatFile **rfile,
|
|||||||
|
|
||||||
if (cat->nb_files >= *nb_files_alloc) {
|
if (cat->nb_files >= *nb_files_alloc) {
|
||||||
unsigned n = FFMAX(*nb_files_alloc * 2, 16);
|
unsigned n = FFMAX(*nb_files_alloc * 2, 16);
|
||||||
if (n <= cat->nb_files ||
|
ConcatFile *new_files;
|
||||||
!(cat->files = av_realloc_f(cat->files, n, sizeof(*cat->files))))
|
if (n <= cat->nb_files || n > SIZE_MAX / sizeof(*cat->files) ||
|
||||||
|
!(new_files = av_realloc(cat->files, n * sizeof(*cat->files))))
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
|
cat->files = new_files;
|
||||||
*nb_files_alloc = n;
|
*nb_files_alloc = n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user