Dear Erveryone:
        I wonder  write a similar software as the openocd on the window
platform, and now I am reading the openocd source.
        I found a piece of code in the "command.c" which is in the folder
"helper". It is just a part of function "unregister_command":
         
        /* unregister children */
        if (c->children)
        {

                for (c2 = c->children; c2; c2 = c2->next)
                {

                        free(c2->name);
                        free(c2);

                }

        }
         
        I mean that first "c2 = c->children", then "free (c2)",  just like
c2 equals NULL, then how "c2 = c2->next" comes?
         
         whether this piece of code is similar to the below one:
         
        if (c->children)
        {

                c2 = c->children;
                c->children = null;
                free(c2->name);
                free(c2);

        }
        2008-12-10 
        ________________________________

        victor 
        
you are quite correct that bit of code is incorrect - it would probably work
on a few systems as not all will NULL the data after a free.

probably never been noticed as the function unregister_command is not called
as far as i am aware.
I will apply a fix.

Thanks
Spen

_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to