This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch release/8.1
in repository ffmpeg.

The following commit(s) were added to refs/heads/release/8.1 by this push:
     new 29e619e767 avcodec/aacsbr_template: don't leak on 
ff_aac_sbr_ctx_alloc_init failure
29e619e767 is described below

commit 29e619e767cde9045a75c29bc9a8278ae7b3a98b
Author:     Timo Rothenpieler <[email protected]>
AuthorDate: Sat Sep 26 00:32:08 2026 +0200
Commit:     Timo Rothenpieler <[email protected]>
CommitDate: Tue Sep 29 20:29:30 2026 +0000

    avcodec/aacsbr_template: don't leak on ff_aac_sbr_ctx_alloc_init failure
    
    Fixes: #YWH-PGM40646-23
    (cherry picked from commit e383b7d532d0f8703f175b4d03e6103fedacc280)
---
 libavcodec/aacsbr_template.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/libavcodec/aacsbr_template.c b/libavcodec/aacsbr_template.c
index 31d2d844c4..b6fa464f93 100644
--- a/libavcodec/aacsbr_template.c
+++ b/libavcodec/aacsbr_template.c
@@ -77,8 +77,7 @@ av_cold int 
AAC_RENAME(ff_aac_sbr_ctx_alloc_init)(AACDecContext *ac,
 
     if (!ext)
         return AVERROR(ENOMEM);
-    *che = &ext->ch;
-    sbr  = &ext->sbr;
+    sbr = &ext->sbr;
     ext->ch.ch[0].AAC_RENAME(predictor_state) = ext->predictor_state[0];
     ext->ch.ch[1].AAC_RENAME(predictor_state) = ext->predictor_state[1];
 
@@ -96,20 +95,25 @@ av_cold int 
AAC_RENAME(ff_aac_sbr_ctx_alloc_init)(AACDecContext *ac,
                      USE_FIXED ? AV_TX_INT32_MDCT : AV_TX_FLOAT_MDCT,
                      1, 64, &scale, 0);
     if (ret < 0)
-        return ret;
+        goto fail;
 
     scale = USE_FIXED ? -1.0 : -2.0 * 32768;
     ret = av_tx_init(&sbr->mdct_ana, &sbr->mdct_ana_fn,
                      USE_FIXED ? AV_TX_INT32_MDCT : AV_TX_FLOAT_MDCT,
                      1, 64, &scale, 0);
     if (ret < 0)
-        return ret;
+        goto fail;
 
     AAC_RENAME(ff_ps_ctx_init)(&sbr->ps);
     AAC_RENAME(ff_sbrdsp_init)(&sbr->dsp);
     aacsbr_func_ptr_init(&sbr->c);
 
+    *che = &ext->ch;
     return 0;
+fail:
+    av_tx_uninit(&sbr->mdct);
+    av_free(ext);
+    return ret;
 }
 
 av_cold void AAC_RENAME(ff_aac_sbr_ctx_close)(ChannelElement *che)

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to