diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-10-06 16:05:39 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-01-11 15:15:53 +0100 |
commit | fdf7a28b0a9003dfcb56c27c962c59cfded6310d (patch) | |
tree | 5445e2ef79719fb3406d95bb721e9c0aa7caeb5f | |
parent | 116dddb928f131226b5c12da8ebab44c660154c1 (diff) | |
download | ffmpeg-fdf7a28b0a9003dfcb56c27c962c59cfded6310d.tar.gz |
avfilter/aeval: Fix leak of expressions upon reallocation error
Fix this by switching to av_dynarray_add_nofree() which is more
natural anyway because the entries of the array are pointers.
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
(cherry picked from commit 05c1f78a72916ef2466cc5a4fc778810503225ee)
-rw-r--r-- | libavfilter/aeval.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/libavfilter/aeval.c b/libavfilter/aeval.c index d5437431ab..7636063bcf 100644 --- a/libavfilter/aeval.c +++ b/libavfilter/aeval.c @@ -124,11 +124,10 @@ static int parse_channel_expressions(AVFilterContext *ctx, } #define ADD_EXPRESSION(expr_) do { \ - if (!av_dynarray2_add((void **)&eval->expr, &eval->nb_channels, \ - sizeof(*eval->expr), NULL)) { \ - ret = AVERROR(ENOMEM); \ + ret = av_dynarray_add_nofree(&eval->expr, \ + &eval->nb_channels, NULL); \ + if (ret < 0) \ goto end; \ - } \ eval->expr[eval->nb_channels-1] = NULL; \ ret = av_expr_parse(&eval->expr[eval->nb_channels - 1], expr_, \ var_names, func1_names, func1, \ |