gdb/tui: Use cleanups to free string copies.
authorAndrew Burgess <andrew.burgess@embecosm.com>
Mon, 6 Jul 2015 17:16:24 +0000 (18:16 +0100)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Fri, 10 Jul 2015 11:39:03 +0000 (12:39 +0100)
commitc101f28fea4fc8621bdf864bc6e2132244dbe6a7
treeea1fd93cd91e517c7afac8138e9b51bd0cf48626
parent150375dc7ac877d1dc6e8aaf73a23479b720306c
gdb/tui: Use cleanups to free string copies.

In parse_scrolling_args it is possible for a string copy to leak if an
error occurs.  Switching to using a cleanup fixes this leak.

In tui_set_win_height the string can't be leaked, but switching to using
a cleanup guards against the possibility that a leak could be introduced
in the future (by adding an error somewhere in the call stack).

gdb/ChangeLog:

* tui/tui-win.c (tui_set_win_height): Use a cleanup to free the
string copy.
(parse_scrolling_args): Likewise.
gdb/ChangeLog
gdb/tui/tui-win.c