summaryrefslogtreecommitdiff
path: root/libavfilter/vf_elbg.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-09-16 14:22:33 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-09-24 00:01:08 +0200
commit6afad4c7e9b9abd785d2b769cbcba3eee4714d48 (patch)
treeb838d6a3ed1cad654df26e5d27d8d237a10ea881 /libavfilter/vf_elbg.c
parent73f47846bd9bf62fed3b9d3f748b858ac7f0a674 (diff)
downloadffmpeg-6afad4c7e9b9abd785d2b769cbcba3eee4714d48.tar.gz
avfilter/vf_elbg: Check call to avpriv_elbg_do()
Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavfilter/vf_elbg.c')
-rw-r--r--libavfilter/vf_elbg.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/libavfilter/vf_elbg.c b/libavfilter/vf_elbg.c
index 2c9c861d02..fac3b6f7fe 100644
--- a/libavfilter/vf_elbg.c
+++ b/libavfilter/vf_elbg.c
@@ -142,7 +142,7 @@ static int config_input(AVFilterLink *inlink)
static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
{
ELBGFilterContext *const elbg = inlink->dst->priv;
- int i, j, k;
+ int i, j, k, ret;
uint8_t *p, *p0;
const uint8_t r_idx = elbg->rgba_map[R];
@@ -164,9 +164,14 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
}
/* compute the codebook */
- avpriv_elbg_do(&elbg->ctx, elbg->codeword, NB_COMPONENTS, elbg->codeword_length,
- elbg->codebook, elbg->codebook_length, elbg->max_steps_nb,
- elbg->codeword_closest_codebook_idxs, &elbg->lfg);
+ ret = avpriv_elbg_do(&elbg->ctx, elbg->codeword, NB_COMPONENTS,
+ elbg->codeword_length, elbg->codebook,
+ elbg->codebook_length, elbg->max_steps_nb,
+ elbg->codeword_closest_codebook_idxs, &elbg->lfg);
+ if (ret < 0) {
+ av_frame_free(&frame);
+ return ret;
+ }
if (elbg->pal8) {
AVFilterLink *outlink = inlink->dst->outputs[0];