* fhandler_base.cc (fhandler_base::readv): Free buf, not a pointer into the
middle of buf.
This commit is contained in:
parent
b397593c94
commit
8eb445cfd3
@ -1,3 +1,8 @@
|
|||||||
|
2005-11-08 Christopher Faylor <cgf@timesys.com>
|
||||||
|
|
||||||
|
* fhandler_base.cc (fhandler_base::readv): Free buf, not a pointer into
|
||||||
|
the middle of buf.
|
||||||
|
|
||||||
2005-11-08 Christopher Faylor <cgf@timesys.com>
|
2005-11-08 Christopher Faylor <cgf@timesys.com>
|
||||||
|
|
||||||
* memmem.cc: New file.
|
* memmem.cc: New file.
|
||||||
|
@ -969,7 +969,7 @@ fhandler_base::readv (const struct iovec *const iov, const int iovcnt,
|
|||||||
if (!len)
|
if (!len)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
char *buf = (char *) malloc (tot);
|
char *buf = (char *) malloc (len);
|
||||||
|
|
||||||
if (!buf)
|
if (!buf)
|
||||||
{
|
{
|
||||||
@ -982,11 +982,12 @@ fhandler_base::readv (const struct iovec *const iov, const int iovcnt,
|
|||||||
|
|
||||||
const struct iovec *iovptr = iov;
|
const struct iovec *iovptr = iov;
|
||||||
|
|
||||||
|
char *p = buf;
|
||||||
while (nbytes > 0)
|
while (nbytes > 0)
|
||||||
{
|
{
|
||||||
const int frag = min (nbytes, (ssize_t) iovptr->iov_len);
|
const int frag = min (nbytes, (ssize_t) iovptr->iov_len);
|
||||||
memcpy (iovptr->iov_base, buf, frag);
|
memcpy (iovptr->iov_base, p, frag);
|
||||||
buf += frag;
|
p += frag;
|
||||||
iovptr += 1;
|
iovptr += 1;
|
||||||
nbytes -= frag;
|
nbytes -= frag;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user