ui/ncurses: Don't free item in pmenu_item_setup
authorJeremy Kerr <jk@ozlabs.org>
Wed, 12 Mar 2014 06:22:47 +0000 (14:22 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Tue, 8 Apr 2014 08:00:38 +0000 (16:00 +0800)
commit28926a0e2f144b09ac9e0a4d019c7f649fd9d5c1
tree7d0371606513ec81b972870e86946da93de32db2
parentbc72527a1426c2159112707d3a6c9bb544fd6647
ui/ncurses: Don't free item in pmenu_item_setup

Currently pmenu_item_setup may free its item parameter on error.

This makes it non-obvious whether the item is still allocated on exit to
the caller.

Instead, this change removes the talloc_free, and requires that the
caller do this on error. This makes the potential use-after-free in
cui_boot_editor_on_exit obvious, so we fix that too.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
ui/ncurses/nc-cui.c
ui/ncurses/nc-menu.c
ui/ncurses/nc-menu.h