# std.unicode: cleanup allocations on error in allocating functions · gitcafe/zig

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

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

Visibility: public

Requested revision: db940a2c8131c52fb6e1f2e40af9c68d2228e656

Requested commit: db940a2c8131c52fb6e1f2e40af9c68d2228e656

Commit: db940a2c8131c52fb6e1f2e40af9c68d2228e656

Tree: e5dda363b6556ce35e3d00211e509e5890651552

Author: Ryan Liptak

Committer: Isaac Freund

## Message

```
std.unicode: cleanup allocations on error in allocating functions

Fixes leaks when `utf16leToUtf8Alloc`/`utf16leToUtf8AllocZ`/`utf8ToUtf16LeWithNull` return an error and adds relevant test cases

```

## Parents

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

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