mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 21:05:08 +00:00
Free old arrays if we increase them.
Pointed out by: mlaier
This commit is contained in:
parent
c4f431a628
commit
65a9b18218
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=183961
|
@ -160,6 +160,7 @@ AddPoint(struct dataset *ds, double a)
|
||||||
ds->lpoints *= 4;
|
ds->lpoints *= 4;
|
||||||
ds->points = calloc(sizeof *ds->points, ds->lpoints);
|
ds->points = calloc(sizeof *ds->points, ds->lpoints);
|
||||||
memcpy(ds->points, dp, sizeof *dp * ds->n);
|
memcpy(ds->points, dp, sizeof *dp * ds->n);
|
||||||
|
free(dp);
|
||||||
}
|
}
|
||||||
ds->points[ds->n++] = a;
|
ds->points[ds->n++] = a;
|
||||||
ds->sy += a;
|
ds->sy += a;
|
||||||
|
|
Loading…
Reference in a new issue