[FFmpeg-devel] [PATCH] avfilter: add sinc source filter
James Almer
jamrial at gmail.com
Thu Oct 18 21:35:00 EEST 2018
On 10/18/2018 3:09 PM, Paul B Mahol wrote:
> + if (!phase1) {
> + begin = 0;
> + } else if (phase1 == 1) {
> + begin = peak - *len / 2;
> + } else {
> + begin = (.997f - (2 - phase1) * .22f) * *len + .5f;
> + end = (.997f + (0 - phase1) * .22f) * *len + .5f;
> + begin = peak - (begin & ~3);
> + end = peak + 1 + ((end + 3) & ~3);
> + *len = end - begin;
> + *h = av_realloc(*h, *len * sizeof(**h));
Either do
*h = av_realloc_f(*h, *len, sizeof(**h));
Or use a temp variable, then manually free *h on failure. Otherwise
you're leaking the original buffer if it failed to be reallocated.
> + if (!*h) {
> + av_free(pi_wraps);
> + av_free(work);
> + return AVERROR(ENOMEM);
> + }
> + }
More information about the ffmpeg-devel
mailing list