History

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

Sebastian Ramacher committed 3 years ago

Commit a562cfe1 parent cd7b3521 file · +4 −4Browse files

Unified · Split

libavcodec/avfft.c+4−4
@@ -46,7 +46,7 @@ FFTContext *av_fft_init(int nbits, int inverse) · 45 unmodified lines
4646 {
4747 int ret;
4848 float scale = 1.0f;
49− AVTXWrapper *s = av_malloc(sizeof(*s));
49+ AVTXWrapper *s = av_mallocz(sizeof(*s));
5050 if (!s)
5151 return NULL;
5252
@@ -85,7 +85,7 @@ FFTContext *av_mdct_init(int nbits, int inverse, double scale) · 32 unmodified lines
8585 {
8686 int ret;
8787 float scale_f = scale;
88− AVTXWrapper *s = av_malloc(sizeof(*s));
88+ AVTXWrapper *s = av_mallocz(sizeof(*s));
8989 if (!s)
9090 return NULL;
9191
@@ -146,7 +146,7 @@ RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans) · 54 unmodified lines
146146 if (trans != IDFT_C2R && trans != DFT_R2C)
147147 return NULL;
148148
149− s = av_malloc(sizeof(*s));
149+ s = av_mallocz(sizeof(*s));
150150 if (!s)
151151 return NULL;
152152
@@ -199,7 +199,7 @@ DCTContext *av_dct_init(int nbits, enum DCTTransformType inverse) · 46 unmodified lines
199199 [DST_I] = AV_TX_FLOAT_DST_I,
200200 };
201201
202− AVTXWrapper *s = av_malloc(sizeof(*s));
202+ AVTXWrapper *s = av_mallocz(sizeof(*s));
203203 if (!s)
204204 return NULL;
205205

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t