command/layout: fix a memory leak

This commit is contained in:
Isaac Freund 2023-01-12 15:34:39 +01:00
parent 615beab2e6
commit 84abdfaced
No known key found for this signature in database
GPG Key ID: 86DED400DDFD7A11

View File

@ -33,7 +33,9 @@ pub fn outputLayout(
if (args.len > 2) return Error.TooManyArguments; if (args.len > 2) return Error.TooManyArguments;
const output = seat.focused_output; const output = seat.focused_output;
const old_layout_namespace = output.layout_namespace;
output.layout_namespace = try util.gpa.dupe(u8, args[1]); output.layout_namespace = try util.gpa.dupe(u8, args[1]);
if (old_layout_namespace) |old| util.gpa.free(old);
output.handleLayoutNamespaceChange(); output.handleLayoutNamespaceChange();
} }