diff options
author | Retro-Junk | 2016-08-25 23:13:37 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2016-08-25 22:17:30 +0200 |
commit | 967ef350d29106580baa48ab63cfaeff7c628ae8 (patch) | |
tree | a220a80e30d27a2bc34e91c35cfec227b31297a3 /engines | |
parent | ed461fba6512a289855f6f39f74163fe13bbcd87 (diff) | |
download | scummvm-rg350-967ef350d29106580baa48ab63cfaeff7c628ae8.tar.gz scummvm-rg350-967ef350d29106580baa48ab63cfaeff7c628ae8.tar.bz2 scummvm-rg350-967ef350d29106580baa48ab63cfaeff7c628ae8.zip |
FULLPIPE: Fix array allocation in StepArray::insertPoints
Diffstat (limited to 'engines')
-rw-r--r-- | engines/fullpipe/statics.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp index a5bbf21151..de1fc77b13 100644 --- a/engines/fullpipe/statics.cpp +++ b/engines/fullpipe/statics.cpp @@ -108,20 +108,22 @@ bool StepArray::gotoNextPoint() { void StepArray::insertPoints(Common::Point **points, int pointsCount) { if (_currPointIndex + pointsCount >= _pointsCount) { - _points = (Common::Point **)realloc(_points, sizeof(Common::Point *) * (_currPointIndex + pointsCount)); + _points = (Common::Point **)realloc(_points, sizeof(Common::Point *) * (_pointsCount + pointsCount)); if (!_points) { error("Out of memory at StepArray::insertPoints()"); } + + for(int i = 0; i < pointsCount; i++) + _points[_pointsCount + i] = new Common::Point; + + _pointsCount += pointsCount; } _maxPointIndex = _currPointIndex + pointsCount; - for (int i = 0; i < pointsCount; i++) { - _points[_currPointIndex + i] = new Common::Point; - + for (int i = 0; i < pointsCount; i++) *_points[_currPointIndex + i] = *points[i]; - } } StaticANIObject::StaticANIObject() { |