abacus-develop
abacus-develop copied to clipboard
(Possible) Bug: memory leak detected by clang-tidy in `read_wfc_nao.cpp` file
Describe the bug
clang-tidy gives following warning:
Potential leak of memory pointed to by 'ctot'C/C++clang-analyzer-cplusplus.NewDeleteLeaks
read_wfc_nao.cpp(98, 9): Assuming 'DRANK' is not equal to 0:
read_wfc_nao.cpp(98, 5): Taking false branch
read_wfc_nao.cpp(112, 9): 'error' is not equal to 1:
read_wfc_nao.cpp(112, 5): Taking false branch
read_wfc_nao.cpp(119, 9): Assuming 'MY_RANK' is equal to 0:
read_wfc_nao.cpp(119, 5): Taking true branch
read_wfc_nao.cpp(129, 13): Assuming the condition is false:
read_wfc_nao.cpp(129, 9): Taking false branch
read_wfc_nao.cpp(135, 18): Assuming the condition is false:
read_wfc_nao.cpp(135, 18): Left side of '||' is false
read_wfc_nao.cpp(135, 54): Assuming the condition is false:
read_wfc_nao.cpp(135, 18): Left side of '||' is false
read_wfc_nao.cpp(136, 21): Assuming the condition is false:
read_wfc_nao.cpp(135, 14): Taking false branch
read_wfc_nao.cpp(144, 18): Assuming 'nbands' is not equal to 'nbands_g':
read_wfc_nao.cpp(144, 14): Taking true branch
read_wfc_nao.cpp(157, 16): Memory is allocated:
read_wfc_nao.cpp(158, 25): Assuming 'i' is >= 'nbands_g':
read_wfc_nao.cpp(158, 9): Loop condition is false. Execution continues on line 163
read_wfc_nao.cpp(163, 25): 'i' is >= 'nbands_g':
read_wfc_nao.cpp(163, 9): Loop condition is false. Execution continues on line 191
read_wfc_nao.cpp(191, 9): 'error' is equal to 2:
read_wfc_nao.cpp(191, 5): Taking true branch
read_wfc_nao.cpp(193, 16): Potential leak of memory pointed to by 'ctot'
Expected behavior
No response
To Reproduce
No response
Environment
No response
Additional Context
No response
Task list for Issue attackers (only for developers)
- [ ] Verify the issue is not a duplicate.
- [ ] Describe the bug.
- [ ] Steps to reproduce.
- [ ] Expected behavior.
- [ ] Error message.
- [ ] Environment details.
- [ ] Additional context.
- [ ] Assign a priority level (low, medium, high, urgent).
- [ ] Assign the issue to a team member.
- [ ] Label the issue with relevant tags.
- [ ] Identify possible related issues.
- [ ] Create a unit test or automated test to reproduce the bug (if applicable).
- [ ] Fix the bug.
- [ ] Test the fix.
- [ ] Update documentation (if necessary).
- [ ] Close the issue and inform the reporter (if applicable).