summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2001-09-20 02:07:44 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2001-09-20 02:07:44 +0000
commit9e21d408b515d379386066277491a6b0c4027e98 (patch)
tree9c4ba8d54a195ce9673743ad18d963dbaf1a7b3b /sys
parent39e804edc0f9f78d3f659a28156548c58f606932 (diff)
Avoid leaking memory if uiomove fails.
Diffstat (limited to 'sys')
-rw-r--r--sys/uvm/uvm_io.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/uvm/uvm_io.c b/sys/uvm/uvm_io.c
index b8ea27a8ee3..b7f09e883c0 100644
--- a/sys/uvm/uvm_io.c
+++ b/sys/uvm/uvm_io.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_io.c,v 1.7 2001/09/19 20:50:59 mickey Exp $ */
+/* $OpenBSD: uvm_io.c,v 1.8 2001/09/20 02:07:43 art Exp $ */
/* $NetBSD: uvm_io.c,v 1.10 2000/06/02 12:02:44 pk Exp $ */
/*
@@ -132,8 +132,6 @@ uvm_io(map, uio)
if (sz > togo)
sz = togo;
error = uiomove((caddr_t) (kva + pageoffset), sz, uio);
- if (error)
- break;
togo -= sz;
baseva += chunksz;
@@ -149,6 +147,13 @@ uvm_io(map, uio)
if (dead_entries != NULL)
uvm_unmap_detach(dead_entries, AMAP_REFALL);
+
+ /*
+ * We defer checking the error return from uiomove until
+ * here so that we won't leak memory.
+ */
+ if (error)
+ break;
}
/*