Am 11.04.2012 03:06, schrieb David Gibson: > On Fri, Apr 06, 2012 at 06:17:12PM +0200, Andreas Färber wrote: >> free() opcode tables. They are being malloc()'ed in create_new_table(). > > This doesn't seem right. Unless I've missed something in the call > path, create_new_table() is not called from the instance initializer. > So surely it should not be torn down in the instance finalizer.
We have this call chain: helper.c:cpu_ppc_init() -> translate_init.c:cpu_ppc_register_internal() -> create_ppc_opcodes() -> create_ppc_opcodes() -> { fill_new_table() (filling it with &invalid_handler), register_insn() -> { register_[dbl]ind_insn() -> register_ind_in_table() -> create_new_table(), register_direct_insn() -> insert_in_table() }(each filling it with non-invalid handlers) } So you are correct that it is not directly called from the initfn. The reason not to do that yet is that cpu_ppc_register_internal() still uses ppc_def_t, which my previous RFC patch series replaces through QOM subclasses. Since free() works fine with zero'ed memory such as after the object_new() in cpu_ppc_init() I still think this patch is fully correct. But we can postpone it if you prefer. Andreas -- SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg