From 785915d833a45aba6dd4f624ab354f948d2e3bda Mon Sep 17 00:00:00 2001 From: utox39 Date: Mon, 28 Jul 2025 23:38:36 +0200 Subject: [PATCH 1/2] fix(linux-gpu): fix double free --- src/linux/hardware.zig | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/linux/hardware.zig b/src/linux/hardware.zig index ce6f689..35fd8bd 100644 --- a/src/linux/hardware.zig +++ b/src/linux/hardware.zig @@ -144,9 +144,8 @@ pub fn getGpuInfo(allocator: std.mem.Allocator) !std.ArrayList(GpuInfo) { ); const gpu_name = try allocator.dupe(u8, std.mem.span(name)); - defer allocator.free(gpu_name); - const parsed_gpu_name = try parseGpuName(allocator, gpu_name); + const parsed_gpu_name = try parseGpuName(allocator, gpu_name) orelse gpu_name; try gpu_info_list.append(GpuInfo{ .gpu_name = parsed_gpu_name, @@ -167,7 +166,7 @@ pub fn getGpuInfo(allocator: std.mem.Allocator) !std.ArrayList(GpuInfo) { return gpu_info_list; } -fn parseGpuName(allocator: std.mem.Allocator, name: []u8) ![]u8 { +fn parseGpuName(allocator: std.mem.Allocator, name: []u8) !?[]u8 { // NOTE: for references: https://github.com/pciutils/pciutils/blob/master/pci.ids if (std.mem.startsWith(u8, name, "Advanced Micro Devices, Inc. [AMD/ATI]")) { @@ -190,7 +189,7 @@ fn parseGpuName(allocator: std.mem.Allocator, name: []u8) ![]u8 { return parsed_gpu_name; } - return name; + return null; } pub fn getRamInfo(allocator: std.mem.Allocator) !RamInfo { From 064e8e95979f663e4d4a828f42781cbfd87d75e3 Mon Sep 17 00:00:00 2001 From: utox39 Date: Mon, 28 Jul 2025 23:39:40 +0200 Subject: [PATCH 2/2] build: bump version to 0.7.3 --- build.zig.zon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.zig.zon b/build.zig.zon index 8ba08dc..0ef4ac2 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -10,7 +10,7 @@ // This is a [Semantic Version](https://semver.org/). // In a future version of Zig it will be used for package deduplication. - .version = "0.7.2", + .version = "0.7.3", // Together with name, this represents a globally unique package // identifier. This field is generated by the Zig toolchain when the