Merge pull request #8 from utox39/fix-linux-gpu/fix-memory-leak
Fix linux gpu/fix memory leak
This commit is contained in:
@@ -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.3",
|
||||
.version = "0.7.4",
|
||||
|
||||
// Together with name, this represents a globally unique package
|
||||
// identifier. This field is generated by the Zig toolchain when the
|
||||
|
||||
@@ -145,7 +145,15 @@ pub fn getGpuInfo(allocator: std.mem.Allocator) !std.ArrayList(GpuInfo) {
|
||||
|
||||
const gpu_name = try allocator.dupe(u8, std.mem.span(name));
|
||||
|
||||
const parsed_gpu_name = try parseGpuName(allocator, gpu_name) orelse gpu_name;
|
||||
const maybe_parsed_gpu_name = try parseGpuName(allocator, gpu_name);
|
||||
var parsed_gpu_name: []u8 = undefined;
|
||||
|
||||
if (maybe_parsed_gpu_name != null) {
|
||||
allocator.free(gpu_name);
|
||||
parsed_gpu_name = maybe_parsed_gpu_name.?;
|
||||
} else {
|
||||
parsed_gpu_name = gpu_name;
|
||||
}
|
||||
|
||||
try gpu_info_list.append(GpuInfo{
|
||||
.gpu_name = parsed_gpu_name,
|
||||
|
||||
Reference in New Issue
Block a user