fix memory leak in List.concat

This commit is contained in:
Folkert 2022-12-28 22:52:32 +01:00
parent 3bc78c2251
commit 2dfa7d6ef1
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C

View file

@ -740,9 +740,8 @@ fn swapElements(source_ptr: [*]u8, element_width: usize, index_1: usize, index_2
}
pub fn listConcat(list_a: RocList, list_b: RocList, alignment: u32, element_width: usize) callconv(.C) RocList {
if (list_a.isEmpty()) {
return list_b;
} else if (list_b.isEmpty()) {
// NOTE we always use list_a! because it is owned, we must consume it, and it may have unused capacity
if (list_b.isEmpty()) {
return list_a;
} else if (list_a.isUnique()) {
const total_length: usize = list_a.len() + list_b.len();