1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

avcodec/iirfilter: Fix memleak

Commit 17e88bf0df created a memleak by
removing a call to ff_iir_filter_free_coeffsp on error; this has been
found by Coverity (ID 1464159). This commit fixes the memleak by
readding the call to ff_iir_filter_free_coeffsp.

Notice that this is not a simple revert, because several macros that
were used before 17e88bf0df were replaced
in commit 44863b2c2d and completely removed
in 2658680df4.

Reviewed-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
Andreas Rheinhardt 2020-06-15 03:33:13 +02:00
parent ea1b71e82f
commit 3aa0be003e

View File

@ -174,7 +174,7 @@ av_cold struct FFIIRFilterCoeffs *ff_iir_filter_init_coeffs(void *avc,
if (!(c = av_mallocz(sizeof(*c))) ||
!(c->cx = av_malloc (sizeof(c->cx[0]) * ((order >> 1) + 1))) ||
!(c->cy = av_malloc (sizeof(c->cy[0]) * order)))
return NULL;
goto free;
c->order = order;
switch (filt_type) {
@ -188,11 +188,13 @@ av_cold struct FFIIRFilterCoeffs *ff_iir_filter_init_coeffs(void *avc,
break;
default:
av_log(avc, AV_LOG_ERROR, "filter type is not currently implemented\n");
return NULL;
goto free;
}
if (!ret)
return c;
free:
ff_iir_filter_free_coeffsp(&c);
return NULL;
}