Rewrite blockdata_retrieve() and expand_buf() to use realloc().

This commit is contained in:
Simon Kelley committed 2026-02-01 21:56:30 +00:00
1 parent 19f3e06e7a
commit fbfcf87f8b
2 files changed
+7 -15

No files matched your search

+1 -7
View File
@@ -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;