From 6b0218ffb89bcba0e31fcfab73d5170eef794c1e Mon Sep 17 00:00:00 2001 From: Michel Pollet Date: Sat, 13 Jun 2015 21:26:50 +0100 Subject: [PATCH] vcd: Prevent crash when close() is called twice flahs() wasn't checking for a valid file pointer Signed-off-by: Michel Pollet --- simavr/sim/sim_vcd_file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simavr/sim/sim_vcd_file.c b/simavr/sim/sim_vcd_file.c index 8b18620..0999db3 100644 --- a/simavr/sim/sim_vcd_file.c +++ b/simavr/sim/sim_vcd_file.c @@ -126,7 +126,7 @@ static void avr_vcd_flush_log(avr_vcd_t * vcd) uint64_t oldbase = 0; // make sure it's different char out[48]; - if (!vcd->logindex) + if (!vcd->logindex || !vcd->output) return; // printf("avr_vcd_flush_log %d\n", vcd->logindex); -- 2.39.5