1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00

avcodec/fft: Use av_mallocz to avoid invalid free/uninit

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
Sebastian Ramacher 2023-11-12 18:46:27 +01:00 committed by James Almer
parent cd7b352c53
commit a562cfee2e

View File

@ -46,7 +46,7 @@ FFTContext *av_fft_init(int nbits, int inverse)
{
int ret;
float scale = 1.0f;
AVTXWrapper *s = av_malloc(sizeof(*s));
AVTXWrapper *s = av_mallocz(sizeof(*s));
if (!s)
return NULL;
@ -85,7 +85,7 @@ FFTContext *av_mdct_init(int nbits, int inverse, double scale)
{
int ret;
float scale_f = scale;
AVTXWrapper *s = av_malloc(sizeof(*s));
AVTXWrapper *s = av_mallocz(sizeof(*s));
if (!s)
return NULL;
@ -146,7 +146,7 @@ RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans)
if (trans != IDFT_C2R && trans != DFT_R2C)
return NULL;
s = av_malloc(sizeof(*s));
s = av_mallocz(sizeof(*s));
if (!s)
return NULL;
@ -199,7 +199,7 @@ DCTContext *av_dct_init(int nbits, enum DCTTransformType inverse)
[DST_I] = AV_TX_FLOAT_DST_I,
};
AVTXWrapper *s = av_malloc(sizeof(*s));
AVTXWrapper *s = av_mallocz(sizeof(*s));
if (!s)
return NULL;