diff options
author | Jun Zhao <barryjzhao@tencent.com> | 2019-12-03 18:16:24 +0800 |
---|---|---|
committer | Jun Zhao <barryjzhao@tencent.com> | 2019-12-07 14:08:08 +0800 |
commit | 46d2a67f80e60128791d3d254fc6c17db6b94db9 (patch) | |
tree | 1d616caec03791f201a3fe4092e387be3f3da8a5 | |
parent | 02a83e26de6a58523ee55cfebc1312e7a4e42724 (diff) | |
download | ffmpeg-46d2a67f80e60128791d3d254fc6c17db6b94db9.tar.gz |
lavfi/avf_showspectrum: Fix the memory leak in error handle path
Fix the memory leak in error handle path.
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
-rw-r--r-- | libavfilter/avf_showspectrum.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/libavfilter/avf_showspectrum.c b/libavfilter/avf_showspectrum.c index d5785af252..3a3ef7eb31 100644 --- a/libavfilter/avf_showspectrum.c +++ b/libavfilter/avf_showspectrum.c @@ -700,16 +700,15 @@ static int draw_legend(AVFilterContext *ctx, int samples) drawtext(s->outpicref, 2, outlink->h - 10, "CREATED BY LIBAVFILTER", 0); drawtext(s->outpicref, outlink->w - 2 - strlen(text) * 10, outlink->h - 10, text, 0); + av_freep(&text); if (s->stop) { - char *text = av_asprintf("Zoom: %d Hz - %d Hz", s->start, s->stop); + text = av_asprintf("Zoom: %d Hz - %d Hz", s->start, s->stop); if (!text) return AVERROR(ENOMEM); drawtext(s->outpicref, outlink->w - 2 - strlen(text) * 10, 3, text, 0); av_freep(&text); } - av_freep(&text); - dst = s->outpicref->data[0] + (s->start_y - 1) * s->outpicref->linesize[0] + s->start_x - 1; for (x = 0; x < s->w + 1; x++) dst[x] = 200; |