From 63e18b176e9e918dd384a1b5450d0789aa381f0a Mon Sep 17 00:00:00 2001 From: Bahadir Balban Date: Sat, 2 May 2009 10:44:23 +0300 Subject: [PATCH] Fixed returning freed field of struct. --- src/api/thread.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/api/thread.c b/src/api/thread.c index a2eb1de..e6c34f8 100644 --- a/src/api/thread.c +++ b/src/api/thread.c @@ -268,6 +268,7 @@ int thread_create(struct task_ids *ids, unsigned int flags) struct ktcb *task = 0; struct ktcb *new = (struct ktcb *)zalloc_page(); unsigned int create_flags = flags & THREAD_CREATE_MASK; + int err; if (!new) return -ENOMEM; @@ -291,8 +292,9 @@ int thread_create(struct task_ids *ids, unsigned int flags) } else { new->pgd = copy_page_tables(task->pgd); if (IS_ERR(new->pgd)) { + err = (int)new->pgd; free_page(new); - return (int)new->pgd; + return err; } } goto out;