From: Godmar Back Date: Fri, 10 Nov 2006 04:17:53 +0000 (+0000) Subject: fixed memory leak on error path in copy_in_string X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a4d72a2eec532fd923e507399bc33e75bb1c3fe5;p=pintos-anon fixed memory leak on error path in copy_in_string --- 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;