Edgar Grimberg plugged a leak found w/Valgrind.
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Wed, 7 May 2008 12:15:19 +0000 (12:15 +0000)
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Wed, 7 May 2008 12:15:19 +0000 (12:15 +0000)
git-svn-id: svn://svn.berlios.de/openocd/trunk@646 b42882b7-edfa-0310-969c-e2dbd0fdcd60

src/helper/command.c
src/helper/command.h
src/openocd.c

index 31666e3a798a1ac7e9f8167fe374ac7d8ca26589..0a120b102a4be492a918597dcc07b8d82084eba4 100644 (file)
@@ -143,6 +143,45 @@ command_t* register_command(command_context_t *context, command_t *parent, char
        return c;
 }
 
+int unregister_all_commands(command_context_t *context)
+{
+       command_t *c, *c2;
+       
+       unique_length_dirty = 1;
+       
+       if (context == NULL)
+               return ERROR_OK;
+       
+       
+       while(NULL != context->commands)
+       {
+               c = context->commands;
+               
+               while(NULL != c->children)
+               {
+                       c2 = c->children;
+                       c->children = c->children->next;
+                       free(c2->name);
+                       c2->name = NULL;
+                       free(c2->help);
+                       c2->help = NULL;
+                       free(c2);
+                       c2 = NULL;
+               }
+               
+               context->commands = context->commands->next;
+               
+               free(c->name);
+               c->name = NULL;
+               free(c->help);
+               c->help = NULL;
+               free(c);
+               c = NULL;               
+       }
+       
+       return ERROR_OK;
+}
+
 int unregister_command(command_context_t *context, char *name)
 {
        command_t *c, *p = NULL, *c2;
index 3586017deee048354c973f96d59de3c038d25aa8..ed6a96a70d259f95b0985e5d71bb784e75ac6896 100644 (file)
@@ -66,6 +66,7 @@ typedef struct command_s
 
 extern command_t* register_command(command_context_t *context, command_t *parent, char *name, int (*handler)(struct command_context_s *context, char* name, char** args, int argc), enum command_mode mode, char *help);
 extern int unregister_command(command_context_t *context, char *name);
+extern int unregister_all_commands(command_context_t *context);
 extern void command_set_output_handler(command_context_t* context, int (*output_handler)(struct command_context_s *context, char* line), void *priv);
 extern command_context_t* copy_command_context(command_context_t* context);
 extern command_context_t* command_init();
index 449736e1615901a75508ccfa39b8fda31639e7d8..946cd93c44842f1b507943f201ae21ecd3598490 100644 (file)
@@ -225,6 +225,8 @@ int main(int argc, char *argv[])
        /* shut server down */
        server_quit();
 
+       unregister_all_commands(cmd_ctx);
+       
        /* free commandline interface */
        command_done(cmd_ctx);
 

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)