Message ID | 20231112151144.2307049-3-sramacher@debian.org |
---|---|
State | New |
Headers | show |
Series | Fix invalid frees, segfaults and memory leaks in avcodec/fft wrappers | expand |
Context | Check | Description |
---|---|---|
yinshiyou/make_loongarch64 | success | Make finished |
yinshiyou/make_fate_loongarch64 | success | Make fate finished |
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
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.
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; }