From 264c27abace06a5316199aaf850156737d01c1dc Mon Sep 17 00:00:00 2001 From: Mikel Negugogor Date: Wed, 3 Jun 2020 14:28:47 -0700 Subject: [PATCH 1/2] PS7AreaContainer bugfix: memset was not covering the allocated array properly, and scalar delete was used instead of vector delete --- src/core/s7_server.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/core/s7_server.cpp b/src/core/s7_server.cpp index e66aa80..efa2027 100644 --- a/src/core/s7_server.cpp +++ b/src/core/s7_server.cpp @@ -54,7 +54,7 @@ void FillTime(PS7Time PTime) //------------------------------------------------------------------------------ PS7AreaContainer::PS7AreaContainer(size_t size) : size(size) { area = new PS7Area[size]; - memset(area, 0, size); + memset(area, 0, size * sizeof(PS7Area)); count = 0; limit = 0; } @@ -153,8 +153,7 @@ void PS7AreaContainer::Dispose() { } } count=0; - limit=0; - delete area; + delete [] area; } //------------------------------------------------------------------------------ // ISO/TCP WORKER CLASS From 0531995164e7129de6721781cca317d7f9b83ed0 Mon Sep 17 00:00:00 2001 From: cci-rwyman <112679961+cci-rwyman@users.noreply.github.com> Date: Thu, 22 Sep 2022 10:34:13 -0700 Subject: [PATCH 2/2] Add change log entry --- src/core/s7_server.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/core/s7_server.cpp b/src/core/s7_server.cpp index efa2027..7625df4 100644 --- a/src/core/s7_server.cpp +++ b/src/core/s7_server.cpp @@ -4,6 +4,12 @@ | Copyright (C) 2013, 2015 Davide Nardella | | All rights reserved. | |==============================================================================| +| Change Log: | +| - 2020-06-03 - Mikel Negugogor - PS7AreaContainer bugfix: memset was not | +| covering the allocated array properly, and scalar delete was | +| used instead of vector delete - change comment added on | +| 2022-09-22 by Ricky Wyman | +|==============================================================================| | SNAP7 is free software: you can redistribute it and/or modify | | it under the terms of the Lesser GNU General Public License as published by | | the Free Software Foundation, either version 3 of the License, or |