Skip to content

argList checking does not release all memory upon failure

Summary

small one: argList checking does not release all memory upon failure.

Steps to reproduce

Run any app with incorrect args.

Relevant logs and/or images

mattijs$ valgrind --leak-check=full  --show-leak-kinds=all  subsetMesh 
==38812== Memcheck, a memory error detector
==38812== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==38812== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
==38812== Command: subsetMesh
==38812== 
Using: OpenFOAM-v2312 (2312) - visit www.openfoam.com
Build: _8afb4c8ecf-20231220

Expected 1 arguments but found 0

See 'subsetMesh -help' for usage
 or 'subsetMesh -help-full' for extended usage

==38812== 
==38812== HEAP SUMMARY:
==38812==     in use at exit: 104 bytes in 2 blocks
==38812==   total heap usage: 44,804 allocs, 44,802 frees, 4,078,666 bytes allocated
==38812== 
==38812== 40 bytes in 1 blocks are still reachable in loss record 1 of 2
==38812==    at 0x4A3813F: operator new[](unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==38812==    by 0x892FB4C: Foam::argList::argList(int&, char**&, bool, bool, bool) (in OpenFOAM/OpenFOAM-plus/release/OpenFOAM-v2312/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so)
==38812==    by 0x45A66F: main (in OpenFOAM/OpenFOAM-plus/release/OpenFOAM-v2312/platforms/linux64GccDPInt32Opt/bin/subsetMesh)

Environment information

  • OpenFOAM version : v2312