# macho: fix use-after-move in placeDecl · gitcafe/zig

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

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

Visibility: public

Requested revision: cf6cfc830db89e0031200d1a16c93eb7801cb911

Requested commit: cf6cfc830db89e0031200d1a16c93eb7801cb911

Commit: cf6cfc830db89e0031200d1a16c93eb7801cb911

Tree: 5aba192c62931ba6a4cafa5e80aafa4d1cac2d20

Author: Jakub Konka

Committer: Jakub Konka

## Message

```
macho: fix use-after-move in placeDecl

Previously, we would get a pointer to a slot in the symbol table,
apply changes to the symbol, and return the pointer. This however
didn't take into account that the symbol table may be moved in memory
in-between the modification and return from the function (`fn placeDecl`).
Prior to my rewrite, this was not possible within the body of the said
function. However, my rewrite revamped how we allocate GOT atoms and
their matching symtab indexes, which now may cause a move in memory
of the container.

```

## Parents

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

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