Fix leaks of 'per program space' and 'per inferior' ada task data.
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Sun, 17 Feb 2019 16:58:17 +0000 (17:58 +0100)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Mon, 18 Feb 2019 21:14:59 +0000 (22:14 +0100)
commit040b3e95e41f7af82e95c781aadc56a16019fd68
treeee4afeb18e8eb33018fd7837347b08caca60e67b
parenta31b8bd9a054b494fd6ab18f14d84a2f0690f8a1
Fix leaks of 'per program space' and 'per inferior' ada task data.

Valgrind reports leaks such as the below.
Fix these leaks by changing ada_tasks_pspace_data_handle
and ada_tasks_inferior_data_handle to use the 'with_cleanup' register variant.

Tested on debian/amd64 natively and under Valgrind.

==26346== 56 bytes in 1 blocks are definitely lost in loss record 631 of 3,249
==26346==    at 0x4C2C4CC: operator new(unsigned long) (vg_replace_malloc.c:344)
==26346==    by 0x38F911: get_ada_tasks_inferior_data(inferior*) (ada-tasks.c:281)
==26346==    by 0x38FA3F: ada_tasks_invalidate_inferior_data (ada-tasks.c:1362)
==26346==    by 0x38FA3F: ada_tasks_new_objfile_observer(objfile*) (ada-tasks.c:1411)
==26346==    by 0x60CBC5: operator() (functional:2127)
==26346==    by 0x60CBC5: notify (observable.h:106)
==26346==    by 0x60CBC5: clear_symtab_users(enum_flags<symfile_add_flag>) (symfile.c:2903)
...

==26346== 104 bytes in 1 blocks are definitely lost in loss record 984 of 3,249
==26346==    at 0x4C2E0BC: calloc (vg_replace_malloc.c:762)
==26346==    by 0x4056F0: xcalloc (common-utils.c:84)
==26346==    by 0x38F8AE: xcnew<ada_tasks_pspace_data> (poison.h:122)
==26346==    by 0x38F8AE: get_ada_tasks_pspace_data(program_space*) (ada-tasks.c:253)
==26346==    by 0x38FA77: ada_tasks_invalidate_pspace_data (ada-tasks.c:1354)
==26346==    by 0x38FA77: ada_tasks_new_objfile_observer(objfile*) (ada-tasks.c:1394)
==26346==    by 0x60CBC5: operator() (functional:2127)
==26346==    by 0x60CBC5: notify (observable.h:106)
...

gdb/ChangeLog
2019-02-18  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

* ada-task.c (_initialize_tasks): Use 'with_cleanup' register
variant for ada_tasks_pspace_data_handle and
ada_tasks_inferior_data_handle.
(ada_tasks_pspace_data_cleanup): New function.
(ada_tasks_inferior_data_cleanup): New function.
gdb/ChangeLog
gdb/ada-tasks.c
This page took 0.025312 seconds and 4 git commands to generate.