From 5a34d21688be234341edce80f217311081f08553 Mon Sep 17 00:00:00 2001 From: Kevin Peterson Date: Thu, 28 Oct 2021 11:55:01 -0500 Subject: [PATCH] Initialize variables to prevent random memory from being freed when SPiiPlusCreateProfile is called --- acsMotionApp/src/SPiiPlusDriver.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/acsMotionApp/src/SPiiPlusDriver.cpp b/acsMotionApp/src/SPiiPlusDriver.cpp index b3d9ef5..9447d2d 100644 --- a/acsMotionApp/src/SPiiPlusDriver.cpp +++ b/acsMotionApp/src/SPiiPlusDriver.cpp @@ -66,6 +66,9 @@ SPiiPlusController::SPiiPlusController(const char* ACSPortName, const char* asyn return; } + // Initialize this variable to avoid freeing random memory + fullProfileTimes_ = 0; + // Query setup parameters getIntegerArray((char *)motorFlags_, "MFLAGS", 0, numAxes_-1, 0, 0); getDoubleArray((char *)stepperFactor_, "STEPF", 0, numAxes_-1, 0, 0); @@ -88,6 +91,9 @@ SPiiPlusController::SPiiPlusController(const char* ACSPortName, const char* asyn // axis resolution (used to convert motor record steps into controller EGU) pAxes_[index]->resolution_ = stepperFactor_[index]; + + // Initialize this variable to avoid freeing random memory + pAxes_[index]->fullProfilePositions_ = 0; } drvUser_ = (SPiiPlusDrvUser_t *) callocMustSucceed(1, sizeof(SPiiPlusDrvUser_t), functionName);