1
0
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:
Alasdair G Kergon 2018-01-09 21:52:19 +00:00
parent b65246499b
commit e2438b5b9f

View File

@ -124,11 +124,12 @@ static int _extend_buffer(struct formatter *f)
log_debug_metadata("Doubling metadata output buffer to " FMTu32, log_debug_metadata("Doubling metadata output buffer to " FMTu32,
f->data.buf.size * 2); f->data.buf.size * 2);
if (!(newbuf = dm_realloc(f->data.buf.start, if (!(newbuf = dm_malloc_aligned(f->data.buf.size * 2, 0)))
f->data.buf.size * 2))) { return_0;
log_error("Buffer reallocation failed.");
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.start = newbuf;
f->data.buf.size *= 2; 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; return_0;
f->data.buf.size = 65536; /* Initial metadata limit */ 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"); log_error("text_export buffer allocation failed");
goto out; goto out;
} }