This is an automated email from Gerrit.

"Mark O'Donovan <[email protected]>" just uploaded a new patch set to Gerrit, 
which you can find at https://review.openocd.org/c/openocd/+/9499

-- gerrit

commit b2796c30b59392b779421db6c729b8d3aeedbf7d
Author: Mark O'Donovan <[email protected]>
Date:   Tue Feb 24 20:44:43 2026 +0000

    pld/gatemate: move pointer deref after NULL check
    
    Move pointer deref after NULL check.
    Found by cppcheck.
    
    Change-Id: Ifdf40046cb1b03dbe7f445660b3349deae788e7b
    Signed-off-by: Mark O'Donovan <[email protected]>

diff --git a/src/pld/gatemate.c b/src/pld/gatemate.c
index f35b39ad21..479f6d1838 100644
--- a/src/pld/gatemate.c
+++ b/src/pld/gatemate.c
@@ -138,11 +138,11 @@ static int gatemate_read_cfg_file(struct 
gatemate_bit_file *bit_file, const char
 
 static int gatemate_read_file(struct gatemate_bit_file *bit_file, const char 
*filename)
 {
-       memset(bit_file, 0, sizeof(struct gatemate_bit_file));
-
        if (!filename || !bit_file)
                return ERROR_COMMAND_SYNTAX_ERROR;
 
+       memset(bit_file, 0, sizeof(struct gatemate_bit_file));
+
        /* check if binary .bit or ascii .cfg */
        const char *file_suffix_pos = strrchr(filename, '.');
        if (!file_suffix_pos) {

-- 

Reply via email to