]> git.sur5r.net Git - openocd/blobdiff - src/target/register.c
target/cortex_m: do not leak memory on reexamination
[openocd] / src / target / register.c
index 42b3b8b64e2fa7e2dcba049f025ba8e8907b0731..1c1717c8ff3b39342c12f5ba3e1f7f82546371eb 100644 (file)
@@ -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)
 {