[FFmpeg-cvslog] avfilter/avf_showspectrum: fix null pointer dereference if allocation fails

Paul B Mahol git at videolan.org
Sat Jan 2 18:53:46 CET 2016


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sat Jan  2 11:49:15 2016 +0100| [d35c029cbf3abf8ce3697ac6145da5eb49950e5d] | committer: Paul B Mahol

avfilter/avf_showspectrum: fix null pointer dereference if allocation fails

Signed-off-by: Paul B Mahol <onemda at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d35c029cbf3abf8ce3697ac6145da5eb49950e5d
---

 libavfilter/avf_showspectrum.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/libavfilter/avf_showspectrum.c b/libavfilter/avf_showspectrum.c
index b7ee266..a19885b 100644
--- a/libavfilter/avf_showspectrum.c
+++ b/libavfilter/avf_showspectrum.c
@@ -194,12 +194,16 @@ static av_cold void uninit(AVFilterContext *ctx)
 
     av_freep(&s->combine_buffer);
     av_rdft_end(s->rdft);
-    for (i = 0; i < s->nb_display_channels; i++)
-        av_freep(&s->rdft_data[i]);
+    if (s->rdft_data) {
+        for (i = 0; i < s->nb_display_channels; i++)
+            av_freep(&s->rdft_data[i]);
+    }
     av_freep(&s->rdft_data);
     av_freep(&s->window_func_lut);
-    for (i = 0; i < s->nb_display_channels; i++)
-        av_freep(&s->magnitudes[i]);
+    if (s->magnitudes) {
+        for (i = 0; i < s->nb_display_channels; i++)
+            av_freep(&s->magnitudes[i]);
+    }
     av_freep(&s->magnitudes);
     av_frame_free(&s->outpicref);
     av_audio_fifo_free(s->fifo);



More information about the ffmpeg-cvslog mailing list