Paul Richards wrote:
> 307 for (callbacks_p = &jtag_event_callbacks;
> 308 *callbacks_p != NULL;
> 309 callbacks_p = next)
..
> 311 next = &((*callbacks_p)->next);
> ...
> 316 if ((*callbacks_p)->callback == callback)
> 317 {
> 318 free(*callbacks_p);
> 319 *callbacks_p = *next;
> 320 }
**next seems excessive. *next would work..
> The assignment after the free() call is accessing the callback
> structure that has just been freed.
..and there would actually not be a problem then. Hopefully easy fix.
I guess someone wanted to use a lot of pointers. For modifying lists
I strongly prefer keeping a pointer direct to the previous entry,
rather than a **.
> Also, the assignment on line 319 doesn't account for the next
> increment in the for statement.
Should it? I don't think the following callback should be skipped
just because the current one is removed.
//Peter
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development