On 3/28/19 11:18 AM, Richard W.M. Jones wrote:
---
filters/truncate/truncate.c | 55 +++++++++++++++++++++++++++++++++++++
1 file changed, 55 insertions(+)
+ extents2 = nbdkit_extents_new (0, real_size_copy);
+ if (offset + count <= real_size_copy)
+ n = count;
+ else
+ n = real_size_copy - offset;
+ if (next_ops->extents (nxdata, n, offset, flags, extents2, err) == -1) {
+ nbdkit_extents_free (extents2);
+ return -1;
+ }
+
+ for (i = 0; i < nbdkit_extents_count (extents2); ++i) {
+ struct nbdkit_extent e = nbdkit_get_extent (extents2, i);
+
+ if (nbdkit_add_extent (extents, e.offset, e.length, e.type) == -1) {
+ nbdkit_extents_free (extents2);
+ return -1;
+ }
+ }
+ nbdkit_extents_free (extents2);
+
Should we be using the CLEANUP_EXTENTS_FREE macro here and in other filters?
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization:
qemu.org |
libvirt.org