From: Peter Lohrmann Date: Mon, 8 Jul 2013 12:20:31 +0000 (+0100) Subject: Delete the file object if the trace file could not be loaded due to being an unsuppor... X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=7eb579d3067914cd8c370ffb577a5917c9616854;p=apitrace 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. --- 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;