From 24dbee0f065b7165b6c18d73b9b6c564b181640b Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 27 Nov 2015 16:37:49 +0100 Subject: FULLPIPE: Check result on realloc() --- engines/fullpipe/statics.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp index de3e1ea728..8ee3b14d0c 100644 --- a/engines/fullpipe/statics.cpp +++ b/engines/fullpipe/statics.cpp @@ -106,9 +106,14 @@ bool StepArray::gotoNextPoint() { } void StepArray::insertPoints(Common::Point **points, int pointsCount) { - if (_currPointIndex + pointsCount >= _pointsCount) + if (_currPointIndex + pointsCount >= _pointsCount) { _points = (Common::Point **)realloc(_points, sizeof(Common::Point *) * (_currPointIndex + pointsCount)); + if (!_points) { + error("Out of memory at StepArray::insertPoints()"); + } + } + _maxPointIndex = _currPointIndex + pointsCount; for (int i = 0; i < pointsCount; i++) { -- cgit v1.2.3