[Bf-blender-cvs] [b4cb467] master: BGE: Fixing memory leaks when deactivating Sensors, Controllers, or actuators.
Mitchell Stokes
noreply at git.blender.org
Sat Apr 19 23:53:29 CEST 2014
Commit: b4cb46735960c2f3c8842a06571eca168b6dcb8a
Author: Mitchell Stokes
Date: Sat Apr 19 14:51:29 2014 -0700
https://developer.blender.org/rBb4cb46735960c2f3c8842a06571eca168b6dcb8a
BGE: Fixing memory leaks when deactivating Sensors, Controllers, or actuators.
Found by Coverity and confirmed with Valgrind.
===================================================================
M source/gameengine/Converter/KX_ConvertActuators.cpp
M source/gameengine/Converter/KX_ConvertControllers.cpp
M source/gameengine/Converter/KX_ConvertSensors.cpp
===================================================================
diff --git a/source/gameengine/Converter/KX_ConvertActuators.cpp b/source/gameengine/Converter/KX_ConvertActuators.cpp
index d7578c3..b59c26a 100644
--- a/source/gameengine/Converter/KX_ConvertActuators.cpp
+++ b/source/gameengine/Converter/KX_ConvertActuators.cpp
@@ -1122,6 +1122,8 @@ void BL_ConvertActuators(const char* maggiename,
// done with baseact, release it
baseact->Release();
}
+ else if (baseact)
+ baseact->Release();
bact = bact->next;
}
diff --git a/source/gameengine/Converter/KX_ConvertControllers.cpp b/source/gameengine/Converter/KX_ConvertControllers.cpp
index cd7a560..0215b60 100644
--- a/source/gameengine/Converter/KX_ConvertControllers.cpp
+++ b/source/gameengine/Converter/KX_ConvertControllers.cpp
@@ -240,6 +240,8 @@ void BL_ConvertControllers(
//done with gamecontroller
gamecontroller->Release();
}
+ else if (gamecontroller)
+ gamecontroller->Release();
bcontr = bcontr->next;
}
diff --git a/source/gameengine/Converter/KX_ConvertSensors.cpp b/source/gameengine/Converter/KX_ConvertSensors.cpp
index 6ab382f..b3c6f6d 100644
--- a/source/gameengine/Converter/KX_ConvertSensors.cpp
+++ b/source/gameengine/Converter/KX_ConvertSensors.cpp
@@ -640,6 +640,9 @@ void BL_ConvertSensors(struct Object* blenderobject,
gamesensor->Release();
}
+ else if (gamesensor)
+ gamesensor->Release();
+
sens=sens->next;
}
}
More information about the Bf-blender-cvs
mailing list