- Type: Correctness
- Severity: Medium
- Component: SUNDIALS memory helper alloc callback
- Location:
Src/Extern/SUNDIALS/AMReX_SUNMemory.cpp:59
Problem
In Alloc, on arena failure the code assigns memptr = nullptr instead of *memptr = nullptr.
This only changes the local parameter and leaves caller-visible output unchanged.
Impact
- Caller may observe stale/uninitialized output pointer on failure.
- Can trigger later invalid memory use paths.
Suggested patch
Set the pointee, not the local parameter variable.
--- a/Src/Extern/SUNDIALS/AMReX_SUNMemory.cpp
+++ b/Src/Extern/SUNDIALS/AMReX_SUNMemory.cpp
@@
- memptr = nullptr;
+ *memptr = nullptr;
return -1;
Prepared by Codex