Ryan Liptak 83e0e23f8a ArrayList.toOwnedSlice: Fix potential for leaks when using errdefer
#13666 introduced a footgun when using `toOwnedSlice` with `errdefer array_list.deinit()`, since `toOwnedSlice` could retain capacity if `resize` failed, meaning it would leak without `deinit` being called. This meant that the only correct way to use `toOwnedSlice` was with `defer` instead of `errdefer` to ensure that the ArrayList would get cleaned up.

Now, toOwnedSlice will now behave similarly to how it did before #13666, in that it will always clear the ArrayList's capacity if the resize/realloc succeeds.

This also reverts commit 05890a12f532ba9d58904a14381ec174b9efe473, which was contingent on the modified toOwnedSlice behavior.

Closes #13946
2022-12-15 02:56:24 -05:00
..
2022-12-13 15:37:52 -05:00
2022-12-14 14:26:02 -07:00
2022-12-13 13:14:20 +02:00
2022-12-14 14:26:02 -07:00
2022-12-14 11:42:28 -05:00
2022-11-30 15:42:59 -07:00
2022-10-06 21:22:20 +03:00
2022-12-14 00:29:25 +00:00
2022-12-13 15:04:03 -05:00
2022-12-14 11:42:28 -05:00
2022-12-13 13:14:20 +02:00
2022-12-11 12:48:18 -07:00
2022-12-09 21:57:17 +01:00
2022-11-04 00:09:27 +03:30
2022-12-13 12:52:21 +02:00
2022-12-14 11:42:28 -05:00
2022-12-13 13:14:20 +02:00
2022-12-14 14:26:02 -07:00
2022-01-07 00:06:06 -05:00
2022-12-06 12:27:28 -07:00
2022-09-11 23:18:43 -04:00
2022-12-13 15:13:25 -05:00
2022-12-13 13:14:20 +02:00
2022-11-23 19:17:58 +01:00
2022-12-13 13:14:20 +02:00
2022-04-15 17:01:01 -05:00