diff options
Diffstat (limited to 'src/sf.zig')
-rw-r--r-- | src/sf.zig | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/sf.zig b/src/sf.zig index dca1cec..80cfd9e 100644 --- a/src/sf.zig +++ b/src/sf.zig @@ -78,6 +78,7 @@ pub const SndFile = struct { frames: usize) Error![]const i16 { const items = frames * @intCast(usize, self.channels); const memory = try allocator.alloc(i16, items); + errdefer allocator.free(memory); const n = sf_read_short(self.pimpl, memory.ptr, @intCast(i64, items)); return try allocator.realloc(memory, @intCast(usize, n)); } |