PR jit/63854: Fix leaks in toyvm.c
authorDavid Malcolm <dmalcolm@redhat.com>
Mon, 1 Dec 2014 17:40:03 +0000 (17:40 +0000)
committerDavid Malcolm <dmalcolm@gcc.gnu.org>
Mon, 1 Dec 2014 17:40:03 +0000 (17:40 +0000)
commit52b9468f1575b87e490cc3fdcff4c51f25fb49c1
treef16b19ca2feb631733943e067ce5d2a3f52f9b23
parent33b625ed6060fea016d99cf268cc68287a93ca0c
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.

From-SVN: r218234
gcc/jit/ChangeLog
gcc/jit/docs/examples/tut04-toyvm/toyvm.c
gcc/jit/docs/intro/tutorial04.rst