# stage2: fix memory leak of emit_bin.sub_path · gitcafe/zig

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

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

Visibility: public

Requested revision: 73ba6bf30be02d65e19304b0ec45c9a2a495698e

Requested commit: 73ba6bf30be02d65e19304b0ec45c9a2a495698e

Commit: 73ba6bf30be02d65e19304b0ec45c9a2a495698e

Tree: 02b4df9737a767b929855e27c35b2c62b6c894e9

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
stage2: fix memory leak of emit_bin.sub_path

Instead of juggling GPA-allocated sub_path (and ultimately dropping the
ball, in this analogy), `Compilation.create` allocates an
already-exactly-correct size `sub_path` that has the digest unpopulated.

This is then overwritten in place as necessary and used as the
`emit_bin.sub_path` value, and no allocations/frees are performed for
this file path.

```

## Parents

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

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