diff options
author | phk <phk@FreeBSD.org> | 2004-07-10 15:42:16 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2004-07-10 15:42:16 +0000 |
commit | b9f13e4266e1a358f8e0f5ee3542e657eabb8a19 (patch) | |
tree | de46976e3a829fc81580355aafed8ed3f3fcdb8e /sys/kern/kern_ktrace.c | |
parent | afe21b6175db45f3406c5cd8c0d1516078e4e32c (diff) | |
download | FreeBSD-src-b9f13e4266e1a358f8e0f5ee3542e657eabb8a19.zip FreeBSD-src-b9f13e4266e1a358f8e0f5ee3542e657eabb8a19.tar.gz |
Clean up and wash struct iovec and struct uio handling.
Add copyiniov() which copies a struct iovec array in from userland into
a malloc'ed struct iovec. Caller frees.
Change uiofromiov() to malloc the uio (caller frees) and name it
copyinuio() which is more appropriate.
Add cloneuio() which returns a malloc'ed copy. Caller frees.
Use them throughout.
Diffstat (limited to 'sys/kern/kern_ktrace.c')
-rw-r--r-- | sys/kern/kern_ktrace.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/kern/kern_ktrace.c b/sys/kern/kern_ktrace.c index 8a2b0a5..694634a 100644 --- a/sys/kern/kern_ktrace.c +++ b/sys/kern/kern_ktrace.c @@ -413,13 +413,17 @@ ktrgenio(fd, rw, uio, error) int datalen; char *buf; - if (error) + if (error) { + free(uio, M_IOV); return; + } uio->uio_offset = 0; uio->uio_rw = UIO_WRITE; datalen = imin(uio->uio_resid, ktr_geniosize); buf = malloc(datalen, M_KTRACE, M_WAITOK); - if (uiomove(buf, datalen, uio)) { + error = uiomove(buf, datalen, uio); + free(uio, M_IOV); + if (error) { free(buf, M_KTRACE); return; } |