task: fix potential mem leak
This commit is contained in:
parent
8f3aea077a
commit
e1dbcf80da
1 changed files with 1 additions and 0 deletions
|
|
@ -45,6 +45,7 @@ pub const Task = struct {
|
||||||
pub fn create(entrypoint: usize) !*Task {
|
pub fn create(entrypoint: usize) !*Task {
|
||||||
// Allocate and initialize the thread structure.
|
// Allocate and initialize the thread structure.
|
||||||
var t = try vmem.create(Task);
|
var t = try vmem.create(Task);
|
||||||
|
errdefer vmem.free(t);
|
||||||
|
|
||||||
t.time_used = 0;
|
t.time_used = 0;
|
||||||
t.state = .ReadyToRun;
|
t.state = .ReadyToRun;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue