fix memory leak when a non-existant exec process is specified
All checks were successful
Generic zig build / build (push) Successful in 21s
All checks were successful
Generic zig build / build (push) Successful in 21s
This commit is contained in:
parent
8a208c237b
commit
f188afc25c
1 changed files with 5 additions and 1 deletions
|
|
@ -67,9 +67,13 @@ const SpeechHandler = struct {
|
|||
// SAFETY: this is set 8 lines below before use
|
||||
.id = undefined,
|
||||
};
|
||||
errdefer self.allocator.destroy(process.child.?);
|
||||
process.child.?.* = std.process.Child.init(&[_][]const u8{ program, text }, self.allocator);
|
||||
try self.child_processes.append(self.allocator, process);
|
||||
errdefer _ = self.child_processes.pop();
|
||||
errdefer {
|
||||
_ = self.child_processes.pop();
|
||||
self.child_processes.shrinkAndFree(self.allocator, self.child_processes.items.len);
|
||||
}
|
||||
try process.child.?.spawn();
|
||||
try process.child.?.waitForSpawn();
|
||||
process.id = process.child.?.id;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue