]> git.proxmox.com Git - mirror_qemu.git/commit
disas: Cleanup plugin_disas
authorRichard Henderson <richard.henderson@linaro.org>
Thu, 10 Sep 2020 22:13:38 +0000 (15:13 -0700)
committerRichard Henderson <richard.henderson@linaro.org>
Sat, 3 Oct 2020 09:25:14 +0000 (04:25 -0500)
commitb71f3a68e2b67c2a26be0a528482fd99a089af3f
tree507a06a7407b187ff9d95f92d1d2203b97bcf60e
parent86944d1d11efaef208566de49a949dd7af232adb
disas: Cleanup plugin_disas

Do not retain a GString in thread-local storage.  Allocate a
new one and free it on every invocation.  Do not g_strdup the
result; return the buffer from the GString.  Do not use
warn_report.

Using cs_disasm allocated memory via the &insn parameter, but
that was never freed.  Use cs_disasm_iter so that we use the
memory that we've already allocated, and so that we only try
to disassemble one insn, as desired.  Do not allocate 1k to
hold the bytes for a single instruction.

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
disas.c