diff options
author | 2001-09-20 02:07:43 +0000 | |
---|---|---|
committer | 2001-09-20 02:07:43 +0000 | |
commit | 4136a7ed34f16e685726f7234ba8f8c90780feec (patch) | |
tree | cb7b7bb3880f3919a06fea29003bd07195e6f89a /sys/uvm/uvm_io.c | |
parent | Get this closer to working (mostly borrowed from macppc). (diff) | |
download | wireguard-openbsd-4136a7ed34f16e685726f7234ba8f8c90780feec.tar.xz wireguard-openbsd-4136a7ed34f16e685726f7234ba8f8c90780feec.zip |
Avoid leaking memory if uiomove fails.
Diffstat (limited to 'sys/uvm/uvm_io.c')
-rw-r--r-- | sys/uvm/uvm_io.c | 11 |
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; } /* |