From c8f803e77a39584af30082b7ba11e69a9f046224 Mon Sep 17 00:00:00 2001 From: Fabien Chouteau Date: Mon, 14 May 2012 23:39:09 +0000 Subject: [PATCH] Avoid segfault in cpu_dump_state Do not call cpu_dump_state if logfile is NULL. Signed-off-by: Fabien Chouteau [agraf: adjust to inline functions] Signed-off-by: Alexander Graf --- qemu-log.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/qemu-log.h b/qemu-log.h index 40f8b7b0c8..2ed19d1578 100644 --- a/qemu-log.h +++ b/qemu-log.h @@ -69,7 +69,9 @@ void GCC_FMT_ATTR(2, 3) qemu_log_mask(int mask, const char *fmt, ...); /* cpu_dump_state() logging functions: */ static inline void log_cpu_state(CPUArchState *env1, int flags) { - cpu_dump_state(env1, qemu_logfile, fprintf, flags); + if (qemu_log_enabled()) { + cpu_dump_state(env1, qemu_logfile, fprintf, flags); + } } static inline void log_cpu_state_mask(int mask, CPUArchState *env1, int flags)