From 3e35f3d88be26fbee07cab10e4c976c937f51fd1 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Thu, 18 Nov 2021 14:53:15 +0100 Subject: [PATCH] Fix memory leaks --- emu.c | 4 ++++ test/flush.c | 2 ++ trace.c | 6 ++++++ trace.h | 2 ++ 4 files changed, 14 insertions(+) diff --git a/emu.c b/emu.c index 0462586..4c7bdcb 100644 --- a/emu.c +++ b/emu.c @@ -1108,6 +1108,10 @@ emu_destroy(struct ovni_emu *emu) close_pcfs(emu); destroy_metadata(emu); ovni_free_streams(&emu->trace); + ovni_free_trace(&emu->trace); + + free(emu->global_cpu); + free(emu->global_thread); } int diff --git a/test/flush.c b/test/flush.c index b43e4d3..fed5311 100644 --- a/test/flush.c +++ b/test/flush.c @@ -90,5 +90,7 @@ int main(void) ovni_flush(); ovni_proc_fini(); + free(payload_buf); + return 0; } diff --git a/trace.c b/trace.c index a31fc90..8d3e265 100644 --- a/trace.c +++ b/trace.c @@ -445,6 +445,12 @@ ovni_free_streams(struct ovni_trace *trace) free(trace->stream); } +void +ovni_free_trace(struct ovni_trace *trace) +{ + free(trace->loom); +} + int ovni_load_next_event(struct ovni_stream *stream) { diff --git a/trace.h b/trace.h index 0af0e28..7e22ba9 100644 --- a/trace.h +++ b/trace.h @@ -29,4 +29,6 @@ int ovni_load_streams(struct ovni_trace *trace); void ovni_free_streams(struct ovni_trace *trace); +void ovni_free_trace(struct ovni_trace *trace); + #endif /* OVNI_TRACE_H */