mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
format_text: Use malloc aligned for export buffer
This commit is contained in:
parent
b65246499b
commit
e2438b5b9f
@ -124,11 +124,12 @@ static int _extend_buffer(struct formatter *f)
|
||||
|
||||
log_debug_metadata("Doubling metadata output buffer to " FMTu32,
|
||||
f->data.buf.size * 2);
|
||||
if (!(newbuf = dm_realloc(f->data.buf.start,
|
||||
f->data.buf.size * 2))) {
|
||||
log_error("Buffer reallocation failed.");
|
||||
return 0;
|
||||
}
|
||||
if (!(newbuf = dm_malloc_aligned(f->data.buf.size * 2, 0)))
|
||||
return_0;
|
||||
|
||||
memcpy(newbuf, f->data.buf.start, f->data.buf.size);
|
||||
free(f->data.buf.start);
|
||||
|
||||
f->data.buf.start = newbuf;
|
||||
f->data.buf.size *= 2;
|
||||
|
||||
@ -1065,7 +1066,7 @@ size_t text_vg_export_raw(struct volume_group *vg, const char *desc, char **buf)
|
||||
return_0;
|
||||
|
||||
f->data.buf.size = 65536; /* Initial metadata limit */
|
||||
if (!(f->data.buf.start = dm_malloc(f->data.buf.size))) {
|
||||
if (!(f->data.buf.start = dm_malloc_aligned(f->data.buf.size, 0))) {
|
||||
log_error("text_export buffer allocation failed");
|
||||
goto out;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user