Fix leak of symbol name in block_symbol_cache
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Sun, 1 Dec 2019 16:24:41 +0000 (17:24 +0100)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Tue, 3 Dec 2019 20:30:12 +0000 (21:30 +0100)
commit82f910ea9cce04b0faabfcd022d9d8949567541e
tree5e7a057817a4cd1b27e0a733ebd45609d10814db
parente63ef0954d02bec8ecb9cf7ff9fc14adc45e8010
Fix leak of symbol name in block_symbol_cache

A symbol not found inserted in the cache has a xstrdup-ed name
that must be freed, but only the struct block_symbol_cache is freed.
Add a function destroy_block_symbol_cache that clears all slots
before releasing the cache.

2019-12-03  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
* symtab.c (symbol_cache_clear_slot):  Move close to cleared type.
(destroy_block_symbol_cache): New function.
(symbol_cache:~symbol_cache) Call destroy_block_symbol_cache.
(resize_symbol_cache): Likewise.
gdb/ChangeLog
gdb/symtab.c