From: Ingo Ruhnke Date: Tue, 12 Aug 2014 20:35:27 +0000 (+0200) Subject: Fixed memory leak in ObjectFactory X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=585d719e3b20f7d781faeb730a15760a011a6e6b;p=supertux.git Fixed memory leak in ObjectFactory --- diff --git a/src/supertux/object_factory.hpp b/src/supertux/object_factory.hpp index b734a1f42..f79c39c68 100644 --- a/src/supertux/object_factory.hpp +++ b/src/supertux/object_factory.hpp @@ -18,8 +18,9 @@ #ifndef HEADER_SUPERTUX_SUPERTUX_OBJECT_FACTORY_HPP #define HEADER_SUPERTUX_SUPERTUX_OBJECT_FACTORY_HPP -#include #include +#include +#include #include "supertux/direction.hpp" #include "util/reader_fwd.hpp" @@ -58,7 +59,7 @@ public: static ObjectFactory& instance(); private: - typedef std::map Factories; + typedef std::map > Factories; Factories factories; public: @@ -73,7 +74,7 @@ private: void add_factory(const char* name) { assert(factories.find(name) == factories.end()); - factories[name] = new ConcreteObjectFactory(); + factories[name] = std::unique_ptr(new ConcreteObjectFactory()); } void init_factories(); };