From a4d72a2eec532fd923e507399bc33e75bb1c3fe5 Mon Sep 17 00:00:00 2001 From: Godmar Back Date: Fri, 10 Nov 2006 04:17:53 +0000 Subject: [PATCH] fixed memory leak on error path in copy_in_string --- solutions/p2.patch | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/solutions/p2.patch b/solutions/p2.patch index 3b2de25..0940c14 100644 --- a/solutions/p2.patch +++ b/solutions/p2.patch @@ -493,7 +493,7 @@ Index: src/userprog/syscall.c diff -u src/userprog/syscall.c~ src/userprog/syscall.c --- src/userprog/syscall.c~ +++ src/userprog/syscall.c -@@ -1,20 +1,483 @@ +@@ -1,20 +1,486 @@ #include "userprog/syscall.h" #include +#include @@ -657,7 +657,10 @@ diff -u src/userprog/syscall.c~ src/userprog/syscall.c + for (length = 0; length < PGSIZE; length++) + { + if (us >= (char *) PHYS_BASE || !get_user (ks + length, us++)) -+ thread_exit (); ++ { ++ palloc_free_page (ks); ++ thread_exit (); ++ } + + if (ks[length] == '\0') + return ks; -- 2.30.2