This is an automated email from Gerrit.

"Antonio Borneo <borneo.anto...@gmail.com>" just uploaded a new patch set to 
Gerrit, which you can find at https://review.openocd.org/c/openocd/+/7014

-- gerrit

commit adce689bf0efd6a3601e83f3155d3e83464c79ce
Author: Antonio Borneo <borneo.anto...@gmail.com>
Date:   Thu Jun 2 11:17:49 2022 +0200

    arm_adi_v5: check for calloc() return value
    
    In function adiv5_jim_configure() check that calloc() returns a
    valid allocated memory pointer.
    
    Change-Id: I97287e168834693900341add9d9eb9a5f38c55b4
    Signed-off-by: Antonio Borneo <borneo.anto...@gmail.com>
    Reported-by: Tomas Vanek <van...@fbl.cz>

diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c
index 52b12cb93f..4d5f02b328 100644
--- a/src/target/arm_adi_v5.c
+++ b/src/target/arm_adi_v5.c
@@ -2044,6 +2044,10 @@ int adiv5_jim_configure(struct target *target, struct 
jim_getopt_info *goi)
        pc = (struct adiv5_private_config *)target->private_config;
        if (!pc) {
                pc = calloc(1, sizeof(struct adiv5_private_config));
+               if (!pc) {
+                       LOG_ERROR("Out of memory");
+                       return JIM_ERR;
+               }
                pc->ap_num = DP_APSEL_INVALID;
                target->private_config = pc;
        }

-- 

Reply via email to