aboutsummaryrefslogtreecommitdiff
path: root/engines/bladerunner/light.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/bladerunner/light.cpp')
-rw-r--r--engines/bladerunner/light.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/engines/bladerunner/light.cpp b/engines/bladerunner/light.cpp
index 08eb8ab5be..8be8d0112b 100644
--- a/engines/bladerunner/light.cpp
+++ b/engines/bladerunner/light.cpp
@@ -27,9 +27,13 @@
namespace BladeRunner {
Light::Light() {
+ _animationData = nullptr;
}
Light::~Light() {
+ if (_animationData != nullptr) {
+ delete[] _animationData;
+ }
}
void Light::read(Common::ReadStream *stream, int framesCount, int frame, int animated) {
@@ -43,6 +47,9 @@ void Light::read(Common::ReadStream *stream, int framesCount, int frame, int ani
_animatedParameters = stream->readUint32LE();
+ if (_animationData != nullptr) {
+ delete[] _animationData;
+ }
int floatsCount = size / 4;
_animationData = new float[floatsCount];
for (int i = 0; i < floatsCount; i++) {
@@ -80,6 +87,10 @@ void Light::readVqa(Common::ReadStream *stream, int framesCount, int frame, int
int size = stream->readUint32LE();
+ if(_animationData != nullptr) {
+ delete[] _animationData;
+ }
+
int floatsCount = size / 4;
_animationData = new float[floatsCount];
for (int i = 0; i < floatsCount; i++) {