# sema: Fix memory leak · gitcafe/zig

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

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

Visibility: public

Requested revision: 79679be50ddfab04d34cb3dc412d4e5088de2126

Requested commit: 79679be50ddfab04d34cb3dc412d4e5088de2126

Commit: 79679be50ddfab04d34cb3dc412d4e5088de2126

Tree: 1adf8cb526b44064f524d4bcf425a4446d381a6d

Author: Luuk de Gram

Committer: Andrew Kelley

## Message

```
sema: Fix memory leak

When a generic call evaluates to a generic type, the call will be re-generated.
However, the old function was not freed before being re-generated, causing a memory leak.
So rather than only returning an error, we first free the old value.

```

## Parents

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

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