Plug target side conditions and commands leaks.
authorPedro Alves <palves@redhat.com>
Fri, 29 Nov 2013 14:50:26 +0000 (14:50 +0000)
committerPedro Alves <palves@redhat.com>
Fri, 29 Nov 2013 14:50:26 +0000 (14:50 +0000)
commit8b4f3082d8f1f7605c6f89f12bc3a93da06845c5
tree74ca59f9f3e1fd1b777e58d05d031524229f234d
parent9f7132948dd9a08e020e6409ebe790d8fd9c6d5d
Plug target side conditions and commands leaks.

The memory management of bp_location->target_info.conditions|tcommands
is currently a little fragile.  If the target reports support for
target conditions or commands, and then target side breakpoint support
is disabled, or some error is thrown before remote_add_target_side_XXX
is called, we'll leak these lists.  This patch makes us free these
lists when the locations are deleted, and also, just before recreating
the commands|conditions lists.

Tested on x86_64 Fedora 17, native and gdbserver.

gdb/
2013-11-29  Pedro Alves  <palves@redhat.com>

* breakpoint.c (build_target_condition_list): Release previous
conditions.
(build_target_command_list): Release previous commands.
(bp_location_dtor): Release target conditions and commands.
* remote.c (remote_add_target_side_condition): Don't release
conditions.
(remote_add_target_side_commands): Don't release commands.
gdb/ChangeLog
gdb/breakpoint.c
gdb/remote.c