[Scummvm-cvs-logs] scummvm master -> 967ef350d29106580baa48ab63cfaeff7c628ae8

sev- sev at scummvm.org
Thu Aug 25 22:17:54 CEST 2016


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
967ef350d2 FULLPIPE: Fix array allocation in StepArray::insertPoints


Commit: 967ef350d29106580baa48ab63cfaeff7c628ae8
    https://github.com/scummvm/scummvm/commit/967ef350d29106580baa48ab63cfaeff7c628ae8
Author: Retro-Junk (bambarbee at yandex.ru)
Date: 2016-08-25T22:17:30+02:00

Commit Message:
FULLPIPE: Fix array allocation in StepArray::insertPoints

Changed paths:
    engines/fullpipe/statics.cpp



diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp
index a5bbf21..de1fc77 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() {






More information about the Scummvm-git-logs mailing list