[FFmpeg-devel] [PATCH 2/3] avcodec/fft: Set potentially unused wrapper variables to avoid invalid free/uninit
James Almer
jamrial at gmail.com
Sun Nov 12 17:17:19 EET 2023
On 11/12/2023 12:11 PM, Sebastian Ramacher wrote:
> ---
> libavcodec/avfft.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/libavcodec/avfft.c b/libavcodec/avfft.c
> index 93203228c2..813b6d61a1 100644
> --- a/libavcodec/avfft.c
> +++ b/libavcodec/avfft.c
> @@ -102,7 +102,8 @@ FFTContext *av_mdct_init(int nbits, int inverse, double scale)
> av_free(s);
> return NULL;
> }
> - }
> + } else
> + s->ctx2 = NULL;
>
> return (FFTContext *)s;
> }
> @@ -220,7 +221,8 @@ DCTContext *av_dct_init(int nbits, enum DCTTransformType inverse)
> av_free(s);
> return NULL;
> }
> - }
> + } else
> + s->tmp = NULL;
>
> return (DCTContext *)s;
> }
IMO just allocate the AVTXWrapper with av_mallocz() instead.
More information about the ffmpeg-devel
mailing list