Add/DeleteNodes: Improved list reference management (realloc)
Description
Improved list reference addition realized during the AddNodes service.
Code version identification
Current behavior
AddNodes
The SOPC_NodeMgtHelperInternal_AddRefToNode function performs the following operations:
- Allocates a new list of references (+1).
- Copies of existing references.
- Add the new reference to the new list.
DeleteNodes
The SOPC_NodeMgtHelperInternal_RemoveLastRefInTargetNode function, clear only the memory (not released) The SOPC_NodeMgtHelperInternal_RemoveRefAtIndex function, allocates a fresh new list if references and copies all references except the one to be removed. Clear + Free the memory of the removed reference.
Expected behavior
AddNodes
- Increases the reference list size with a
realloc, in order to replace 1. Allocates and 2. Copies.
DeleteNodes
- Decreases the reference list size with a
realloc(reference clear before deletion).
Security impact
None
Implementation
Use SOPC_Realloc.
Edited by Sebastien Tajan