mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-14 07:45:04 +00:00
fix memory leak in List.concat
This commit is contained in:
parent
3bc78c2251
commit
2dfa7d6ef1
1 changed files with 2 additions and 3 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue