# GPA: Catch invalid frees · gitcafe/zig

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

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

Visibility: public

Requested revision: 49b56f88b92eb0f0e66e7cfa329392c918c1777e

Requested commit: 49b56f88b92eb0f0e66e7cfa329392c918c1777e

Commit: 49b56f88b92eb0f0e66e7cfa329392c918c1777e

Tree: 69db3a981457c21cac91aa1729f2eb8c419100af

Author: Ganesan Rajagopal

Committer: GitHub

## Message

```
GPA: Catch invalid frees

* GPA: Catch invalid frees

Fix #14791: Catch cases where an invalid slice is passed to free().
This was silently ignored before but now logs an error. This change
uses a AutoHashMap to keep track of the sizes which seems to be an
overkill but seems like the easiest way to catch these errors.

* GPA: Add wrong alignment checks to free/resize

Implement @Inkryption's suggestion to catch free/resize with the wrong
alignment. I also changed the naming to match large allocations.
```

## Parents

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

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