mirror of
http://thekelleys.org.uk/git/dnsmasq.git
synced 2026-10-25 12:14:38 +00:00
Rewrite blockdata_retrieve() and expand_buf() to use realloc().
This commit is contained in:
2 files changed
+7
-15
No files matched your search
+1
-7
@@ -680,18 +680,12 @@ int expand_buf(struct iovec *iov, size_t size)
|
||||
if (size <= (size_t)iov->iov_len)
|
||||
return 1;
|
||||
|
||||
if (!(new = whine_malloc(size)))
|
||||
if (!(new = whine_realloc(iov->iov_base, size)))
|
||||
{
|
||||
errno = ENOMEM;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (iov->iov_base)
|
||||
{
|
||||
memcpy(new, iov->iov_base, iov->iov_len);
|
||||
free(iov->iov_base);
|
||||
}
|
||||
|
||||
iov->iov_base = new;
|
||||
iov->iov_len = size;
|
||||
|
||||
|
||||
Reference in new issue
Block a user