PR #25584 opened by nitanshnagpal
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25584
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25584.patch

# Summary of changes

  `abitscope` allocates a per-channel color table (`s->fg`) in
  `config_input()`, but `uninit()` only frees `s->outpicref`, so the table
  is never freed. Every instance leaks `nb_channels * 4` bytes; the leak
  has been there since the filter was added in ee8e00b703.

  This frees it in `uninit()` with `av_freep()`.

  ## Testing

  - Before: `leaks --atExit` (macOS, arm64) reports 1 leak of 16 bytes for
    `ffmpeg -f lavfi -i sine=d=0.2 -filter_complex abitscope -frames:v 3 -f 
null -`
  - After: 0 leaks, with mono and 5.1 input and with `mode=0` and `mode=1`.
  - Clean under an AddressSanitizer build (`--toolchain=clang-asan`).

  No new FATE samples are needed.


>From ea51f08da9c05fe2e60216f2d8c9c7c23644292d Mon Sep 17 00:00:00 2001
From: nitanshnagpal38 <[email protected]>
Date: Thu, 29 Oct 2026 18:41:23 +0530
Subject: [PATCH] avfilter/avf_abitscope: free the channel color table on
 uninit

s->fg is allocated in config_input() but never freed, so every
abitscope instance leaks nb_channels * 4 bytes.
---
 libavfilter/avf_abitscope.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavfilter/avf_abitscope.c b/libavfilter/avf_abitscope.c
index 3a92490368c..f3346c35e3e 100644
--- a/libavfilter/avf_abitscope.c
+++ b/libavfilter/avf_abitscope.c
@@ -287,6 +287,7 @@ static av_cold void uninit(AVFilterContext *ctx)
     AudioBitScopeContext *s = ctx->priv;
 
     av_frame_free(&s->outpicref);
+    av_freep(&s->fg);
 }
 
 static const AVFilterPad inputs[] = {
-- 
2.54.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to