Free old arrays if we increase them.

Pointed out by:	mlaier
This commit is contained in:
Poul-Henning Kamp 2008-10-16 20:56:09 +00:00
parent c4f431a628
commit 65a9b18218
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=183961

View file

@ -160,6 +160,7 @@ AddPoint(struct dataset *ds, double a)
ds->lpoints *= 4;
ds->points = calloc(sizeof *ds->points, ds->lpoints);
memcpy(ds->points, dp, sizeof *dp * ds->n);
free(dp);
}
ds->points[ds->n++] = a;
ds->sy += a;