Steve Grubb <sgrubb@redhat.com> fix various and sundry leaks
[openocd.git] / src / target / etm.c
index 48d2ebaf3a1150001faba2ec4e115d80eef868ec..2623ebe53fb41a77f31320fda155b01754346433 100644 (file)
@@ -246,6 +246,12 @@ reg_cache_t* etm_build_reg_cache(target_t *target, arm_jtag_t *jtag_info, etm_co
                if (!etb)
                {
                        LOG_ERROR("etb selected as etm capture driver, but no ETB configured");
+                       for (i = 0; i < num_regs; i++)
+                       {
+                               free(reg_list[i].value);
+                       }
+                       free(reg_cache);
+                       free(arch_info);
                        return ERROR_OK;
                }
 
@@ -1202,6 +1208,7 @@ static int handle_etm_config_command(struct command_context_s *cmd_ctx, char *cm
 
        if (argc != 5)
        {
+               free(etm_ctx);
                return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
@@ -1209,12 +1216,14 @@ static int handle_etm_config_command(struct command_context_s *cmd_ctx, char *cm
        if (!target)
        {
                LOG_ERROR("target '%s' not defined", args[0]);
+               free(etm_ctx);
                return ERROR_FAIL;
        }
 
        if (arm7_9_get_arch_pointers(target, &armv4_5, &arm7_9) != ERROR_OK)
        {
                command_print(cmd_ctx, "current target isn't an ARM7/ARM9 target");
+               free(etm_ctx);
                return ERROR_FAIL;
        }
 
@@ -1231,6 +1240,7 @@ static int handle_etm_config_command(struct command_context_s *cmd_ctx, char *cm
                        break;
                default:
                        command_print(cmd_ctx, "unsupported ETM port width '%s', must be 4, 8 or 16", args[1]);
+                       free(etm_ctx);
                        return ERROR_FAIL;
        }
 
@@ -1249,6 +1259,7 @@ static int handle_etm_config_command(struct command_context_s *cmd_ctx, char *cm
        else
        {
                command_print(cmd_ctx, "unsupported ETM port mode '%s', must be 'normal', 'multiplexed' or 'demultiplexed'", args[2]);
+               free(etm_ctx);
                return ERROR_FAIL;
        }
 
@@ -1263,6 +1274,7 @@ static int handle_etm_config_command(struct command_context_s *cmd_ctx, char *cm
        else
        {
                command_print(cmd_ctx, "unsupported ETM port clocking '%s', must be 'full' or 'half'", args[3]);
+               free(etm_ctx);
                return ERROR_FAIL;
        }
 

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)