L2SS-1125: Resolve issues on arm hardfloat platform using 64bits debian
The opcua server codebase was subject to several memory leaks including stack use after free and heap overflows. These have caused quite a ghost chase about probably causes leading to the suspicion that the open62541 library was to blame. Further investigations with address sanitizer let to the discovery of these errors.
In this patch the opcua server codebase is rewritten to remove any memory errors. In addition the variable registration has been updated to a templated method reducing about 600 lines of duplicate code. Lastly, a job has been added to the CI/CD pipeline that compiles and runs the program and asserts that no memory leaks are found.
Leak tests can be performed manually at leisure by adding the makeflags -g3 -fsanitize=address -fno-omit-frame-pointer
.
To conclude:
- Removing the
-O3
parameter from the makeflags is not necessary - Compiling and linking open62541 as shared library is not necessary
- More care is needed to prevent coding memory errors.
- The opcua add_variable methods have been reduced to a single templated method
- A CI/CD job to assert the absence of memory leaks has been added.
Closes L2SS-1125