Rules for calling uio_free
Rules for calling uio_free
- Subject: Rules for calling uio_free
- From: Ron Aldrich <email@hidden>
- Date: Thu, 15 Sep 2005 16:20:00 -0700
Folks,
I'm looking through the darwin sources, to determine how to update
those portions of my kext which use uiomove, and I see what appear to
be memory leaks all over the kernel.
In those parts of the kernel that use uio_create to construct a uio
object, they invariably call uio_free to dispose of it (as you would
expect).
However, in those parts of the kernel that use uio_createwithbuffer
to create a uio object, uio_free is NOT called, and the uio object is
leaked.
As an example, from vn.c:
static int
file_io(struct vnode * vp, struct vfs_context * context_p,
enum uio_rw op, char * base, off_t offset, user_ssize_t count,
user_ssize_t * resid)
{
uio_t auio;
int error;
char uio_buf[UIO_SIZEOF(1)];
auio = uio_createwithbuffer(1, offset, UIO_SYSSPACE, op,
&uio_buf[0], sizeof(uio_buf));
uio_addiov(auio, CAST_USER_ADDR_T(base), count);
if (op == UIO_READ)
error = VNOP_READ(vp, auio, IO_SYNC, context_p);
else
error = VNOP_WRITE(vp, auio, IO_SYNC, context_p);
if (resid != NULL) {
*resid = uio_resid(auio);
}
return (error);
}
My question is, is this actually correct code? Or am I right that it
leaks a uio object every time it's called?
Best Regards,
Ron Aldrich
Software Architects, Inc.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden