summaryrefslogtreecommitdiff
path: root/libavformat/concatdec.c
diff options
context:
space:
mode:
authorNicolas George <nicolas.george@normalesup.org>2012-12-12 12:15:57 +0100
committerNicolas George <nicolas.george@normalesup.org>2012-12-12 12:15:57 +0100
commit16c3cb9bbf2d9f5dc1c77433b731d50a560d7367 (patch)
treef7dcc19d6e044c134b7277ccec55448a1767e57c /libavformat/concatdec.c
parent75b3911e5a6d8f504723303444f534878e09a954 (diff)
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.
Diffstat (limited to 'libavformat/concatdec.c')
-rw-r--r--libavformat/concatdec.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
index 29233e2c8c..858701fd9e 100644
--- a/libavformat/concatdec.c
+++ b/libavformat/concatdec.c
@@ -69,9 +69,11 @@ static int add_file(AVFormatContext *avf, char *filename, ConcatFile **rfile,
if (cat->nb_files >= *nb_files_alloc) {
unsigned n = FFMAX(*nb_files_alloc * 2, 16);
- if (n <= cat->nb_files ||
- !(cat->files = av_realloc_f(cat->files, n, sizeof(*cat->files))))
+ ConcatFile *new_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);
+ cat->files = new_files;
*nb_files_alloc = n;
}