1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-03-28 12:32:17 +02:00

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>
This commit is contained in:
Andreas Rheinhardt 2021-10-06 16:05:39 +02:00
parent bae96fa977
commit 05c1f78a72

View File

@ -124,11 +124,10 @@ static int parse_channel_expressions(AVFilterContext *ctx,
} }
#define ADD_EXPRESSION(expr_) do { \ #define ADD_EXPRESSION(expr_) do { \
if (!av_dynarray2_add((void **)&eval->expr, &eval->nb_channels, \ ret = av_dynarray_add_nofree(&eval->expr, \
sizeof(*eval->expr), NULL)) { \ &eval->nb_channels, NULL); \
ret = AVERROR(ENOMEM); \ if (ret < 0) \
goto end; \ goto end; \
} \
eval->expr[eval->nb_channels-1] = NULL; \ eval->expr[eval->nb_channels-1] = NULL; \
ret = av_expr_parse(&eval->expr[eval->nb_channels - 1], expr_, \ ret = av_expr_parse(&eval->expr[eval->nb_channels - 1], expr_, \
var_names, func1_names, func1, \ var_names, func1_names, func1, \