avfilter/af_aiir: Avoid unchecked allocation
W has not been checked at all; allocate it jointly with M to fix this. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@@ -828,17 +828,17 @@ static int convert_serial2parallel(AVFilterContext *ctx, int channels)
|
|||||||
double *impulse = av_calloc(length, sizeof(*impulse));
|
double *impulse = av_calloc(length, sizeof(*impulse));
|
||||||
double *y = av_calloc(length, sizeof(*y));
|
double *y = av_calloc(length, sizeof(*y));
|
||||||
double *resp = av_calloc(length, sizeof(*resp));
|
double *resp = av_calloc(length, sizeof(*resp));
|
||||||
double *M = av_calloc((length - 1) * 2 * nb_biquads, sizeof(*M));
|
double *M = av_calloc((length - 1) * nb_biquads, 2 * 2 * sizeof(*M));
|
||||||
double *W = av_calloc((length - 1) * 2 * nb_biquads, sizeof(*W));
|
double *W;
|
||||||
|
|
||||||
if (!impulse || !y || !resp || !M) {
|
if (!impulse || !y || !resp || !M) {
|
||||||
av_free(impulse);
|
av_free(impulse);
|
||||||
av_free(y);
|
av_free(y);
|
||||||
av_free(resp);
|
av_free(resp);
|
||||||
av_free(M);
|
av_free(M);
|
||||||
av_free(W);
|
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
}
|
}
|
||||||
|
W = M + (length - 1) * 2 * nb_biquads;
|
||||||
|
|
||||||
impulse[0] = 1.;
|
impulse[0] = 1.;
|
||||||
|
|
||||||
@@ -877,7 +877,6 @@ static int convert_serial2parallel(AVFilterContext *ctx, int channels)
|
|||||||
av_free(y);
|
av_free(y);
|
||||||
av_free(resp);
|
av_free(resp);
|
||||||
av_free(M);
|
av_free(M);
|
||||||
av_free(W);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user