You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
avfilter/vf_colormap: Avoid allocation of small array
The number of elements is always two or three. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@@ -24,6 +24,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "libavutil/attributes.h"
|
#include "libavutil/attributes.h"
|
||||||
|
#include "libavutil/avassert.h"
|
||||||
#include "libavutil/common.h"
|
#include "libavutil/common.h"
|
||||||
#include "libavutil/opt.h"
|
#include "libavutil/opt.h"
|
||||||
#include "avfilter.h"
|
#include "avfilter.h"
|
||||||
@@ -134,20 +135,15 @@ static void gauss_solve_triangular(const double *A, const int *p, double *b, int
|
|||||||
|
|
||||||
static int gauss_solve(double *A, double *b, int n)
|
static int gauss_solve(double *A, double *b, int n)
|
||||||
{
|
{
|
||||||
int *p = av_calloc(n, sizeof(*p));
|
int p[3] = { 0 };
|
||||||
|
|
||||||
if (!p)
|
av_assert2(n <= FF_ARRAY_ELEMS(p));
|
||||||
return 1;
|
|
||||||
|
|
||||||
if (!gauss_make_triangular(A, p, n)) {
|
if (!gauss_make_triangular(A, p, n))
|
||||||
av_freep(&p);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
|
||||||
|
|
||||||
gauss_solve_triangular(A, p, b, n);
|
gauss_solve_triangular(A, p, b, n);
|
||||||
|
|
||||||
av_freep(&p);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user