]> git.mxchange.org Git - flightgear.git/blobdiff - src/Model/modelmgr.cxx
Reported by cppcheck: fix a memory leak
[flightgear.git] / src / Model / modelmgr.cxx
index 600086d29e9d77ece1819bc319f6e8f6fac1fa87..181435ef1c76665603052b8a1039baa3ccd0f8f4 100644 (file)
@@ -16,6 +16,7 @@
 #include <algorithm>
 #include <functional>
 #include <vector>
+#include <cstring>
 
 #include <osg/Math>
 
@@ -82,6 +83,7 @@ FGModelMgr::add_model (SGPropertyNode * node)
   } catch (const sg_throwable& t) {
     SG_LOG(SG_GENERAL, SG_ALERT, "Error loading " << path << ":\n  "
         << t.getFormattedMessage() << t.getOrigin());
+    delete instance;
     return;
   }