diff --git a/libswscale/graph.c b/libswscale/graph.c index db11591862..3b16037767 100644 --- a/libswscale/graph.c +++ b/libswscale/graph.c @@ -702,8 +702,10 @@ static int adapt_colors(SwsGraph *graph, SwsFormat src, SwsFormat dst, SwsFormat tmp = src; tmp.format = fmt_in; ret = add_convert_pass(graph, &src, &tmp, input, &input); - if (ret < 0) + if (ret < 0) { + ff_sws_lut3d_free(&lut); return ret; + } } ret = ff_sws_lut3d_generate(lut, fmt_in, fmt_out, &map);