task: fix potential mem leak

This commit is contained in:
Jack Halford 2020-01-06 21:48:40 +01:00
parent 8f3aea077a
commit e1dbcf80da

View file

@ -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;