Skip to content

Commit b307b33

Browse files
authored
Fix memory disappearing in new test (#27868)
Fixes the fixes added in #27856 by making sure to delete the memory at the end of the test (since it is still being used by other variables) Tested locally with ASAN and `--memLeaks` [Reviewed by @benharsh]
2 parents b9843fb + 7f9ed73 commit b307b33

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

test/classes/delete-free/borrow-bug-27827.chpl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ proc main() {
1818
writeln(r1, r2, r3, r4, sep =" | ");
1919

2020
var newUnmanagedClass = new unmanaged MyClass(20);
21-
delete r1.x;
21+
var oldR1X = r1.x;
22+
defer { delete oldR1X; }
2223
r1.x = newUnmanagedClass;
2324
r2.x = newUnmanagedClass:borrowed;
2425

0 commit comments

Comments
 (0)