diff --git a/Frame_C++_class_v5.0.5.pdf b/Frame_C++_class_v5.0.6.pdf similarity index 86% rename from Frame_C++_class_v5.0.5.pdf rename to Frame_C++_class_v5.0.6.pdf index a49ab43..0f6baa5 100644 Binary files a/Frame_C++_class_v5.0.5.pdf and b/Frame_C++_class_v5.0.6.pdf differ diff --git a/README.md b/README.md index c6045d8..f82e493 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ # **Frame C++ class** -**v5.0.5** +**v5.0.6** @@ -52,6 +52,7 @@ Frame class is basic class for other projects. Main file **Frame.h** contains de | 5.0.3 | 22.06.2023 | - Added build guide. | | 5.0.4 | 06.07.2023 | - Documentation updated. | | 5.0.5 | 12.11.2023 | - Fixed errors serialization/deserialization functions. | +| 5.0.6 | 14.12.2023 | - Memory leakage from "=" operator fixed. | diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d1b34dd..39d6bf6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 3.13) ## LIBRARY-PROJECT ## name and version ################################################################################ -project(Frame VERSION 5.0.4 LANGUAGES CXX) +project(Frame VERSION 5.0.6 LANGUAGES CXX) diff --git a/src/Frame.cpp b/src/Frame.cpp index 8523015..da374da 100644 --- a/src/Frame.cpp +++ b/src/Frame.cpp @@ -93,6 +93,9 @@ Frame::Frame(uint32_t _width, Frame::Frame(Frame &src) { + // free memory if allocated before. + release(); + // Copy fields. width = src.width; height = src.height; @@ -223,6 +226,7 @@ Frame &Frame::operator= (const Frame &src) { data = new uint8_t[size]; memset(data, 0, size); + m_isAllocated = true; } // Copy data. diff --git a/src/FrameVersion.h b/src/FrameVersion.h index e18308e..2e7cbc3 100644 --- a/src/FrameVersion.h +++ b/src/FrameVersion.h @@ -2,6 +2,6 @@ #define FRAME_MAJOR_VERSION 5 #define FRAME_MINOR_VERSION 0 -#define FRAME_PATCH_VERSION 4 +#define FRAME_PATCH_VERSION 6 -#define FRAME_VERSION "5.0.4" +#define FRAME_VERSION "5.0.6" diff --git a/test/main.cpp b/test/main.cpp index 7fe056b..48dd401 100644 --- a/test/main.cpp +++ b/test/main.cpp @@ -63,7 +63,7 @@ int main(void) else cout << "OK" << endl << endl; - return -1; + return 1; } @@ -511,34 +511,4 @@ bool serializationTest() } return true; -} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +} \ No newline at end of file