44a45
> paramOut(cp, base + ".bufLength", bufLength);
53,56c54,65
< if (length) {
< assert(data == nullptr);
< data = new uint8_t[length];
< arrayParamIn(cp, base + ".data", data, length);
---
> unsigned chkpt_buf_length;
> if (optParamIn(cp, base + ".bufLength", chkpt_buf_length)) {
> // If bufLength is in the checkpoint, make sure that the current buffer
> // is unallocated or that the checkpoint requested size is smaller than
> // the current buffer.
> assert(!data || chkpt_buf_length <= bufLength);
> bufLength = chkpt_buf_length;
> } else {
> // If bufLength is not in the checkpoint, try to use the existing
> // buffer or use length to size the buffer
> if (!data)
> bufLength = length;
57a67,70
> assert(length <= bufLength);
> if (!data)
> data = new uint8_t[bufLength];
> arrayParamIn(cp, base + ".data", data, length);