]> git.cworth.org Git - apitrace/blobdiff - trace_parser.cpp
Reset the container after deleting all the elements.
[apitrace] / trace_parser.cpp
index b0b501ac25aabb35419cf2cba5ea0d935939c6f3..44d1786ac207fe2fa576a88c9cfae90339013fdc 100644 (file)
@@ -29,6 +29,7 @@
 #include <stdlib.h>
 
 #include "trace_file.hpp"
+#include "trace_snappyfile.hpp"
 #include "trace_parser.hpp"
 
 
@@ -83,15 +84,18 @@ deleteAll(Iter begin, Iter end)
 
 template <typename Container>
 inline void
-deleteAll(const Container &c)
+deleteAll(Container &c)
 {
     deleteAll(c.begin(), c.end());
+    c.clear();
 }
 
 void Parser::close(void) {
-    file->close();
-    delete file;
-    file = NULL;
+    if (file) {
+        file->close();
+        delete file;
+        file = NULL;
+    }
 
     deleteAll(calls);
     deleteAll(functions);