Explorar o código

Fix some memory leaks

Streetwalrus Einstein %!s(int64=10) %!d(string=hai) anos
pai
achega
b59cda7002
Modificáronse 2 ficheiros con 3 adicións e 1 borrados
  1. 2 0
      src/engine/StateMachine.cpp
  2. 1 1
      src/map/Map.cpp

+ 2 - 0
src/engine/StateMachine.cpp

@@ -19,6 +19,8 @@ STATEMACHINE::StateMachine(State *state)
 
 STATEMACHINE::~StateMachine()
 {
+    while (!stack.empty())
+        pop();
 }
 
 void STATEMACHINE::push(State *state)

+ 1 - 1
src/map/Map.cpp

@@ -22,7 +22,7 @@ MAP::Map(int width, int height, uint16_t *layer0, uint16_t *layer1) : anim()
 
 MAP::~Map()
 {
-    // TODO if you allocate dynamically members
+    delete this->renderer;
 }
 
 void MAP::update(unsigned dt)