+ memcpy(rrdnew.stat_head,rrdold.stat_head,sizeof(stat_head_t));
+
+ if ((rrdnew.rra_def = (rra_def_t *)malloc(sizeof(rra_def_t) * rrdold.stat_head->rra_cnt)) == NULL) {
+ rrd_set_error("allocating rra_def for new RRD");
+ rrd_free(&rrdnew);
+ rrd_free(&rrdold);
+ rrd_close(rrd_file);
+ return (-1);
+ }
+ memcpy(rrdnew.rra_def,rrdold.rra_def,sizeof(rra_def_t) * rrdold.stat_head->rra_cnt);
+
+ /* Set this so that the file will be created with the correct size */
+ rrdnew.rra_def[target_rra].row_cnt += modify;
+