Merge pull request #1148 from nullptrdevs/misc-fixes

Mem fixes
This commit is contained in:
Lee Cannon 2023-04-24 14:59:57 +01:00 committed by GitHub
commit 71e819c56a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 2 deletions

View File

@ -7,7 +7,7 @@ const zls_version = std.builtin.Version{ .major = 0, .minor = 11, .patch = 0 };
pub fn build(b: *std.build.Builder) !void { pub fn build(b: *std.build.Builder) !void {
comptime { comptime {
const current_zig = builtin.zig_version; const current_zig = builtin.zig_version;
const min_zig = std.SemanticVersion.parse("0.11.0-dev.2571+31738de28") catch unreachable; // add c_char - https://github.com/ziglang/zig/pull/15263 const min_zig = std.SemanticVersion.parse("0.11.0-dev.2730+bd801dc48") catch unreachable; // gpa.deinit() now returns an enum
if (current_zig.order(min_zig) == .lt) { if (current_zig.order(min_zig) == .lt) {
@compileError(std.fmt.comptimePrint("Your Zig version v{} does not meet the minimum build requirement of v{}", .{ current_zig, min_zig })); @compileError(std.fmt.comptimePrint("Your Zig version v{} does not meet the minimum build requirement of v{}", .{ current_zig, min_zig }));
} }

View File

@ -1549,6 +1549,7 @@ pub fn create(
message_tracing_enabled: bool, message_tracing_enabled: bool,
) !*Server { ) !*Server {
const server = try allocator.create(Server); const server = try allocator.create(Server);
errdefer server.destroy();
server.* = Server{ server.* = Server{
.config = config, .config = config,
.runtime_zig_version = null, .runtime_zig_version = null,

View File

@ -164,7 +164,7 @@ fn getConfig(
) !ConfigWithPath { ) !ConfigWithPath {
if (config_path) |path| { if (config_path) |path| {
if (configuration.loadFromFile(allocator, path)) |config| { if (configuration.loadFromFile(allocator, path)) |config| {
return ConfigWithPath{ .config = config, .config_path = path }; return ConfigWithPath{ .config = config, .config_path = try allocator.dupe(u8, path) };
} }
std.debug.print( std.debug.print(
\\Could not open configuration file '{s}' \\Could not open configuration file '{s}'