check for already allocated memory

This commit is contained in:
Michael Kirsch 2019-05-19 17:22:03 +02:00 committed by Joseph Lenox
parent d4d1975a8f
commit a3a7f97e28

View File

@ -189,8 +189,20 @@ void stl_transform(stl_file const *stl_src, stl_file *stl_dst, float const *traf
int i_face, i_vertex, i, j;
if (stl_src->error || stl_dst->error)
return;
if (stl_dst->stats.facets_malloced != stl_src->stats.number_of_facets)
{
stl_dst->stats.number_of_facets = stl_src->stats.number_of_facets;
if (stl_dst->stats.facets_malloced > 0)
{
stl_reallocate(stl_dst);
}
else
{
stl_allocate(stl_dst);
}
}
printf("Supplied trafo: %.1f, %.1f, %.1f, %.1f, %.1f, %.1f, %.1f, %.1f, %.1f, %.1f, %.1f, %.1f\n",
trafo3x4[0],
trafo3x4[1],