When appending data to an existing file, don't reallocate buffers if
they are already large enough.
Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
* we need to reallocate.
*/
act[p]->nr2 = file_act[i].nr2;
+ if (act[p]->nr_ini > act[p]->nr_allocated) {
+ act[p]->nr_allocated = act[p]->nr_ini;
+ }
SREALLOC(act[p]->_buf0, void,
- (size_t) act[p]->msize * (size_t) act[p]->nr_ini * (size_t) act[p]->nr2);
- act[p]->nr_allocated = act[p]->nr_ini;
+ (size_t) act[p]->msize * (size_t) act[p]->nr_allocated * (size_t) act[p]->nr2);
/* Save activity sequence */
id_seq[i] = file_act[i].id;