Skip to content

Commit

Permalink
fix mem leak in zig example
Browse files Browse the repository at this point in the history
  • Loading branch information
jethrodaniel committed Apr 22, 2024
1 parent b2a69f6 commit 64d9dcd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/example.zig
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub fn main() !void {
try wav_file.seekTo(44); // skip wav header

const wav_data_slice = try wav_file.readToEndAlloc(allocator, std.math.maxInt(u32));
errdefer allocator.free(wav_data_slice);
defer allocator.free(wav_data_slice);

const model_path_c_str = @as([*c]const u8, @constCast(@ptrCast(model_path)));
const wav_data_c = @as([*c]u8, @ptrCast(@alignCast(wav_data_slice)));
Expand Down

0 comments on commit 64d9dcd

Please sign in to comment.