From dec5bc8acea8c591075fbedc2300e546b60ea8f3 Mon Sep 17 00:00:00 2001
From: John Thacker <johnthacker@gmail.com>
Date: Sun, 22 Mar 2026 23:31:58 +0000
Subject: [PATCH] iLBC codec: Fix double-free

Fixup d871c6c6afad0e634e5d411debe5d8db75218d6b

Fix #21113

AI-Assisted: no


(cherry picked from commit 24ba8d3ba427b0aeda63ff83e4dbbce363e3ae44)

Co-authored-by: John Thacker <johnthacker@gmail.com>
---
 plugins/codecs/iLBC/iLBCdecode.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Index: wireshark-3.6.24/plugins/codecs/iLBC/iLBCdecode.c
===================================================================
--- wireshark-3.6.24.orig/plugins/codecs/iLBC/iLBCdecode.c
+++ wireshark-3.6.24/plugins/codecs/iLBC/iLBCdecode.c
@@ -51,8 +51,9 @@ codec_iLBC_init(void)
 static void
 codec_iLBC_release(void *ctx)
 {
-    WebRtcIlbcfix_DecoderFree(((ilbc_ctx_t *)ctx)->ilbc_ctx);
-    g_free(ctx);
+    ilbc_ctx_t *dataCtx = (ilbc_ctx_t *)ctx->priv;
+    WebRtcIlbcfix_DecoderFree(dataCtx->ilbc_ctx);
+    g_free(dataCtx);
 }
 
 static unsigned
