PR jit/63854: Fix leaks in toyvm.c
authordmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 1 Dec 2014 17:40:03 +0000 (17:40 +0000)
committerdmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 1 Dec 2014 17:40:03 +0000 (17:40 +0000)
commitdd6bd36536d87e00077591b0b15e080509fee731
treef16b19ca2feb631733943e067ce5d2a3f52f9b23
parentce67b8a6dc52db0eb2e120c0dedc2118683a82e5
PR jit/63854: Fix leaks in toyvm.c

gcc/jit/ChangeLog:
PR jit/63854
* docs/examples/tut04-toyvm/toyvm.c
(toyvm_compiled_function): New typedef.
(toyvm_compiled_func) Rename to...
(toyvm_compiled_code) ...this.
(struct toyvm_compiled_function): New struct.
(toyvm_function_compile): Return a toyvm_compiled_function *
rather than a toyvm_compiled_func, so that the caller can fully
clean things up.  Free "funcname".
(test_script): Update for change to toyvm_function_compile.
Clean up the toyvm_compiled_function.
(main): Likewise.
(docs/intro/tutorial04.rst): Update to reflect the above changes,
and to better spell out the lifetime of the compiled code.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@218234 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/jit/ChangeLog
gcc/jit/docs/examples/tut04-toyvm/toyvm.c
gcc/jit/docs/intro/tutorial04.rst