swresample/resample: free existing ResampleContext on reinit
Fixes memleak. Reviewed-by: wm4 <nfxjfg@googlemail.com> Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com> (cherry picked from commit db7a05dab0652d4ec6d89394c9024d02f44494a7)
This commit is contained in:
parent
2423dd9656
commit
4c97b79cf5
@ -314,6 +314,7 @@ static ResampleContext *resample_init(ResampleContext *c, int out_rate, int in_r
|
|||||||
if (!c || c->phase_shift != phase_shift || c->linear!=linear || c->factor != factor
|
if (!c || c->phase_shift != phase_shift || c->linear!=linear || c->factor != factor
|
||||||
|| c->filter_length != FFMAX((int)ceil(filter_size/factor), 1) || c->format != format
|
|| c->filter_length != FFMAX((int)ceil(filter_size/factor), 1) || c->format != format
|
||||||
|| c->filter_type != filter_type || c->kaiser_beta != kaiser_beta) {
|
|| c->filter_type != filter_type || c->kaiser_beta != kaiser_beta) {
|
||||||
|
resample_free(&c);
|
||||||
c = av_mallocz(sizeof(*c));
|
c = av_mallocz(sizeof(*c));
|
||||||
if (!c)
|
if (!c)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user