target/cortex_m: do not leak memory on reexamination
This bug was exposed by Valgrind. Change-Id: If50878664d928c0a44e309ca1452089c1ac71466 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/2542 Tested-by: jenkins Reviewed-by: Stian Skjelstad <stian@nixia.no> Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
This commit is contained in:
@@ -72,6 +72,14 @@ struct reg_cache **register_get_last_cache_p(struct reg_cache **first)
|
||||
return cache_p;
|
||||
}
|
||||
|
||||
void register_unlink_cache(struct reg_cache **cache_p, const struct reg_cache *cache)
|
||||
{
|
||||
while (*cache_p && *cache_p != cache)
|
||||
cache_p = &((*cache_p)->next);
|
||||
if (*cache_p)
|
||||
*cache_p = cache->next;
|
||||
}
|
||||
|
||||
/** Marks the contents of the register cache as invalid (and clean). */
|
||||
void register_cache_invalidate(struct reg_cache *cache)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user