commit 8d45e8e912e27702d05a3a6da32e6b8808f0ad02
parent 2c2d225e58bb28970411172328de5c277511a476
Author: Autumn! <autumnull@posteo.net>
Date: Tue, 27 Dec 2022 17:18:07 +0000
Fix memory leaks in os::exec::{finish, clearenv}
Signed-off-by: Autumn! <autumnull@posteo.net>
Diffstat:
1 file changed, 2 insertions(+), 0 deletions(-)
diff --git a/os/exec/cmd.ha b/os/exec/cmd.ha
@@ -63,6 +63,7 @@ export fn setname(cmd: *command, name: str) void = {
export fn finish(cmd: *command) void = {
platform_finish(cmd);
free(cmd.argv);
+ free(cmd.env);
};
// Executes a prepared command in the current address space, overwriting the
@@ -87,6 +88,7 @@ export fn start(cmd: *command) (error | process) = {
// Empties the environment variables for the command. By default, the command
// inherits the environment of the parent process.
export fn clearenv(cmd: *command) void = {
+ free(cmd.env);
cmd.env = [];
};