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

Showing the changes to libavcodec (1 of 1 file). Show all

Unified · Split

libavcodec/avfft.c+4−4
@@ -46,7 +46,7 @@ FFTContext *av_fft_init(int nbits, int inverse) · 45 unmodified lines
46{46{
47 int ret;47 int ret;
48 float scale = 1.0f;48 float scale = 1.0f;
49 AVTXWrapper *s = av_malloc(sizeof(*s));49 AVTXWrapper *s = av_mallocz(sizeof(*s));
50 if (!s)50 if (!s)
51 return NULL;51 return NULL;
52 52
@@ -85,7 +85,7 @@ FFTContext *av_mdct_init(int nbits, int inverse, double scale) · 32 unmodified lines
85{85{
86 int ret;86 int ret;
87 float scale_f = scale;87 float scale_f = scale;
88 AVTXWrapper *s = av_malloc(sizeof(*s));88 AVTXWrapper *s = av_mallocz(sizeof(*s));
89 if (!s)89 if (!s)
90 return NULL;90 return NULL;
91 91
@@ -146,7 +146,7 @@ RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans) · 54 unmodified lines
146 if (trans != IDFT_C2R && trans != DFT_R2C)146 if (trans != IDFT_C2R && trans != DFT_R2C)
147 return NULL;147 return NULL;
148 148
149 s = av_malloc(sizeof(*s));149 s = av_mallocz(sizeof(*s));
150 if (!s)150 if (!s)
151 return NULL;151 return NULL;
152 152
@@ -199,7 +199,7 @@ DCTContext *av_dct_init(int nbits, enum DCTTransformType inverse) · 46 unmodified lines
199 [DST_I] = AV_TX_FLOAT_DST_I,199 [DST_I] = AV_TX_FLOAT_DST_I,
200 };200 };
201 201
202 AVTXWrapper *s = av_malloc(sizeof(*s));202 AVTXWrapper *s = av_mallocz(sizeof(*s));
203 if (!s)203 if (!s)
204 return NULL;204 return NULL;
205 205

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