Avoid memory leak in chew
authorTom Tromey <tom@tromey.com>
Wed, 15 Feb 2023 23:09:35 +0000 (16:09 -0700)
committerAlan Modra <amodra@gmail.com>
Sun, 19 Feb 2023 02:47:41 +0000 (13:17 +1030)
commit85fc5801281d38897b652b298d35074b7b73ed3a
treeca0d82b6478f18654299a5f759adec85610d66e6
parentcd414f90c340145d811259d10e84b126d73777d0
Avoid memory leak in chew

An earlier patch of mine introduced a memory leak in chew.  The bug
was that the new "variable" word didn't free the following word.  This
patch fixes it by arranging to transfer ownership of the name to the
variable itself.

* doc/chew.c (add_variable): New function, from
add_intrinsic_variable.
(add_intrinsic_variable): Call add_variable.
(compile): Call add_variable.
bfd/doc/chew.c