mirror of
https://gcc.gnu.org/git/gcc.git
synced 2025-01-19 02:44:59 +08:00
Fix leak in splay-tree
Philippe Waroquiers noticed a memory leak in gdb, which he tracked down to a bug in splay-tree. splay_tree_remove does not call the `delete_key' function when it removes the old node; but it should. I looked at every splay tree in GCC and there is only one that passes a non-NULL delete function -- the one in lto.c. That file does not call splay_tree_remove. So, I think this is safe to check in. I re-ran the LTO tests to double check. libiberty/ * splay-tree.c (splay_tree_remove): Delete the key if necessary. From-SVN: r268116
This commit is contained in:
parent
c73e7656f5
commit
2197ea1791
@ -1,3 +1,7 @@
|
||||
2019-01-21 Tom Tromey <tom@tromey.com>
|
||||
|
||||
* splay-tree.c (splay_tree_remove): Delete the key if necessary.
|
||||
|
||||
2019-01-14 Tom Honermann <tom@honermann.net>
|
||||
|
||||
* cp-demangle.c (cplus_demangle_builtin_types)
|
||||
|
@ -425,6 +425,8 @@ splay_tree_remove (splay_tree sp, splay_tree_key key)
|
||||
right = sp->root->right;
|
||||
|
||||
/* Delete the root node itself. */
|
||||
if (sp->delete_key)
|
||||
(*sp->delete_key) (sp->root->key);
|
||||
if (sp->delete_value)
|
||||
(*sp->delete_value) (sp->root->value);
|
||||
(*sp->deallocate) (sp->root, sp->allocate_data);
|
||||
|
Loading…
Reference in New Issue
Block a user