[Chapel Merge] Fix memory leak in `set.add()`

Branch: refs/heads/main
Revision: 5de3f32
Author: dlongnecke-cray
Link: Fix memory leak in `set.add()` by dlongnecke-cray · Pull Request #18910 · chapel-lang/chapel · GitHub
Log Message:

Merge pull request #18910 from dlongnecke-cray/fix-set-record-of-string-memleak

Fix memory leak in set.add()

One of the helper methods used to implement the add() method takes
its argument with pragma "no auto destroy". I forgot to manually
deinitialize the element in the event that its value was already
contained in the set.

Fix the described memory leak and add a test.

Reviewed by @e-kayrakli. Thanks!

TESTING

  • [x] library/standard/Set on linux64 with COMM=none, -memleaks
  • [x] library/standard/Set on linux64 with gasnet, -memleaks
  • [x] ALL on linux64 when COMM=none

Signed-off-by: David Longnecker dlongnecke-cray@users.noreply.github.com

Modified Files:
A test/library/standard/Set/setRecordContainingString.chpl

A test/library/standard/Set/setRecordContainingString.execopts
A test/library/standard/Set/setRecordContainingString.good
M modules/standard/Set.chpl

Compare: https://github.com/chapel-lang/chapel/compare/13a261b91a42...5de3f3289b89