# std.BufSet.clone: fix key ownership · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/543bee0adf2d3b036654fa0983c16ff7023f504c)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 543bee0adf2d3b036654fa0983c16ff7023f504c

Requested commit: 543bee0adf2d3b036654fa0983c16ff7023f504c

Commit: 543bee0adf2d3b036654fa0983c16ff7023f504c

Tree: f5aaeb93432acd7f8bff670dc3229c99ff7dbb71

Author: Motiejus Jakštys

Committer: Andrew Kelley

## Message

```
std.BufSet.clone: fix key ownership

This was introduced in d1a46548349a902c30057b3ba66ebad9bc25bdd2: when a
BufSet clones the keys, it used to assign the new pointers to the old
struct. Fix that by assigning the pointers to the correct, i.e. the new,
struct.

This caused double-free when using arena allocator for the new struct,
also in the test case.

```

## Parents

- [52205a3c162d5adaf98be1dbf96bf86afd658182](https://git.cafe/gitcafe/zig/commit/52205a3c162d5adaf98be1dbf96bf86afd658182?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/543bee0adf2d3b036654fa0983c16ff7023f504c?format=markdown)
