projects
/
pintos-anon
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
8b939b8
)
fixed memory leak on error path in copy_in_string
author
Godmar Back
<godmar@gmail.com>
Fri, 10 Nov 2006 04:17:53 +0000
(
04:17
+0000)
committer
Godmar Back
<godmar@gmail.com>
Fri, 10 Nov 2006 04:17:53 +0000
(
04:17
+0000)
solutions/p2.patch
patch
|
blob
|
history
diff --git
a/solutions/p2.patch
b/solutions/p2.patch
index 3b2de25db568f5e6f05e09e73fae1a3d6e97d96a..0940c141ee2d9b97c4c898cf3e8c2c57d1110041 100644
(file)
--- 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
diff -u src/userprog/syscall.c~ src/userprog/syscall.c
--- src/userprog/syscall.c~
+++ src/userprog/syscall.c
-@@ -1,20 +1,48
3
@@
+@@ -1,20 +1,48
6
@@
#include "userprog/syscall.h"
#include <stdio.h>
+#include <string.h>
#include "userprog/syscall.h"
#include <stdio.h>
+#include <string.h>
@@
-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++))
+ 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;
+
+ if (ks[length] == '\0')
+ return ks;