aboutsummaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-04-27 00:54:37 -0400
committerIan Moffett <ian@osmora.org>2024-04-27 00:54:37 -0400
commit1b06e8c0547de9e43f59bb11179216d25655305f (patch)
treea46352470e44268a02f02d1c83871b66f239b437 /sys/kern
parentfe4465124d1d9486910440641e1df287a0d3f56f (diff)
kernel: kern_exec: Fixup cleanup in execv()
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_exec.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index 1c91025..bcd7a2e 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -130,7 +130,7 @@ exec_set_stack(struct proc *td, struct exec_args args)
static int
execv(char *pathname, char **argv, uintptr_t *sp_res)
{
- char *bin;
+ char *bin = NULL;
struct filedesc *filedes;
struct vm_range *exec_range;
struct exec_args args;
@@ -204,10 +204,11 @@ execv(char *pathname, char **argv, uintptr_t *sp_res)
*sp_res = exec_set_stack(td, args);
set_frame_ip(td->tf, args.auxv.at_entry);
done:
- /* We are done, free argp and release the thread */
+ /* We are done, cleanup and release the thread */
+ if (bin != NULL) dynfree(bin);
fd_close_fdnum(td, fd);
- spinlock_release(&td->lock);
dynfree(args.argp);
+ spinlock_release(&td->lock);
return ret;
}