examples/gkurve: fix memory leak

This commit is contained in:
dweiller 2022-07-21 14:12:38 +10:00 committed by Stephen Gutekanst
parent 35930b1600
commit 4f7d3ddedf

View file

@ -83,6 +83,7 @@ pub fn init(app: *App, core: *mach.Core) !void {
atlas_white_region.height -= 2; atlas_white_region.height -= 2;
const white_texture_uv_data = atlas_white_region.getUVData(atlas_float_size); const white_texture_uv_data = atlas_white_region.getUVData(atlas_float_size);
var white_tex_data = try core.allocator.alloc(zigimg.color.Rgba32, white_tex_scale * white_tex_scale); var white_tex_data = try core.allocator.alloc(zigimg.color.Rgba32, white_tex_scale * white_tex_scale);
defer core.allocator.free(white_tex_data);
std.mem.set(zigimg.color.Rgba32, white_tex_data, zigimg.color.Rgba32.initRGB(0xff, 0xff, 0xff)); std.mem.set(zigimg.color.Rgba32, white_tex_data, zigimg.color.Rgba32.initRGB(0xff, 0xff, 0xff));
app.texture_atlas_data.set(atlas_white_region, white_tex_data); app.texture_atlas_data.set(atlas_white_region, white_tex_data);