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

Git pushed a commit to branch master
in repository ffmpeg.

commit 97daefb4d6775aff6b143dbdb4ad743fe2b3a577
Author:     zhang xingxing <[email protected]>
AuthorDate: Tue Oct 13 06:57:02 2026 +0200
Commit:     michaelni <[email protected]>
CommitDate: Tue Oct 20 11:36:57 2026 +0000

    avformat/tls_mbedtls: free the mbedtls contexts on every error path
    
    This is not a security issue.
    
    Not replicated, compile tested only (mbedtls 3.6.2).
    
    Fixes: T7EtPuJBKWqg
    Fixes: swarm-Memory-leak-early-return-skips-mbedtls-resource-cleanup-a1d295
    
    Found-by: zhang xingxing <[email protected]>
    Signed-off-by: Michael Niedermayer <[email protected]>
---
 libavformat/tls_mbedtls.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/tls_mbedtls.c b/libavformat/tls_mbedtls.c
index 444148be8a..211652d38a 100644
--- a/libavformat/tls_mbedtls.c
+++ b/libavformat/tls_mbedtls.c
@@ -186,7 +186,7 @@ static int mbedtls_gen_x509_cert(mbedtls_pk_context *key, 
char *cert_buf, size_t
     ret = av_random_bytes((uint8_t *)serial, sizeof(serial));
     if (ret < 0) {
         av_log(NULL, AV_LOG_ERROR, "Failed to generate random serial 
number!\n");
-        return ret;
+        goto end;
     }
 
     if ((ret = mbedtls_x509write_crt_set_serial_raw(&crt, serial, 
sizeof(serial))) != 0) {
@@ -208,7 +208,7 @@ static int mbedtls_gen_x509_cert(mbedtls_pk_context *key, 
char *cert_buf, size_t
     if ((ret = mbedtls_x509write_crt_pem(&crt, cert_buf, cert_sz,
                                         mbedtls_ctr_drbg_random, &ctr_drbg)) 
!= 0) {
         av_log(NULL, AV_LOG_ERROR, "mbedtls_x509write_crt_pem returned %d\n", 
ret);
-        return ret;
+        goto end;
     }
 
 end:

-- 
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