From 7eb579d3067914cd8c370ffb577a5917c9616854 Mon Sep 17 00:00:00 2001 From: Peter Lohrmann Date: Mon, 8 Jul 2013 13:20:31 +0100 Subject: [PATCH] Delete the file object if the trace file could not be loaded due to being an unsupported (newer) version. Fix small memory leak / assert if a trace file can't be loaded due to being recorded with a newer version number than qapitrace. In this scenario, there is no error message that gets shown in the UI, but the title bar is updated with the trace file name, so the situation is very confusing. --- common/trace_parser.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/trace_parser.cpp b/common/trace_parser.cpp index f7a1f78..a9cdd0f 100644 --- a/common/trace_parser.cpp +++ b/common/trace_parser.cpp @@ -65,6 +65,8 @@ bool Parser::open(const char *filename) { version = read_uint(); if (version > TRACE_VERSION) { std::cerr << "error: unsupported trace format version " << version << "\n"; + delete file; + file = NULL; return false; } api = API_UNKNOWN; -- 2.45.2