]> git.cworth.org Git - apitrace/commitdiff
Delete the file object if the trace file could not be loaded due to being an unsuppor...
authorPeter Lohrmann <peterl@valvesoftware.com>
Mon, 8 Jul 2013 12:20:31 +0000 (13:20 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Mon, 8 Jul 2013 12:20:31 +0000 (13:20 +0100)
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

index f7a1f78e54b1e0f511a78bc8ee49a17ef51b153b..a9cdd0fbc0586465be407522a0148146e05f283a 100644 (file)
@@ -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;