This is an automated email from Gerrit.

"Samuel Obuch <[email protected]>" just uploaded a new patch set to 
Gerrit, which you can find at https://review.openocd.org/c/openocd/+/9113

-- gerrit

commit 048e5e0367bd3e716341cdcaa1b051484a0962d6
Author: Samuel Obuch <[email protected]>
Date:   Mon Sep 8 13:25:04 2025 +0200

    target/xtensa: fix memory leaks in reg_cache
    
    There are two allocated fields that are never freed,
    contiguous_regs_desc and contiguous_regs_list.
    
    Change-Id: Id6ab4a2565ddb19e1e9d3f1c3b822182b3a6fb9d
    Signed-off-by: Samuel Obuch <[email protected]>

diff --git a/src/target/xtensa/xtensa.c b/src/target/xtensa/xtensa.c
index f8c36b01d7..22c51cc93f 100644
--- a/src/target/xtensa/xtensa.c
+++ b/src/target/xtensa/xtensa.c
@@ -3493,6 +3493,14 @@ static void xtensa_free_reg_cache(struct target *target)
                free(xtensa->optregs);
        }
        xtensa->optregs = NULL;
+       if (xtensa->contiguous_regs_desc) {
+               free(xtensa->contiguous_regs_desc);
+               xtensa->contiguous_regs_desc = NULL;
+       }
+       if (xtensa->contiguous_regs_list) {
+               free(xtensa->contiguous_regs_list);
+               xtensa->contiguous_regs_list = NULL;
+       }
 }
 
 void xtensa_target_deinit(struct target *target)

-- 

Reply via email to