Skip to content

Commit

Permalink
#67
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-Romain committed Dec 7, 2023
1 parent a4aa9eb commit b38aacc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/LASlib/lasdefinitions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -756,12 +756,18 @@ class LASheader : public LASquantizer, public LASattributer
if (delete_data)
{
delete [] evlrs[i].data;
evlrs[i].data = 0;
}
}
number_of_extended_variable_length_records--;
if (number_of_extended_variable_length_records)
{
evlrs[i] = evlrs[number_of_extended_variable_length_records];
// Fix for #67. I do not understand why realloc corrupts the memory.
LASevlr* tmp = (LASevlr*)calloc(number_of_extended_variable_length_records, sizeof(LASevlr));
for (U32 j = 0, k = 0; j < number_of_extended_variable_length_records+1; ++j) { if (j != i) { tmp[k++] = evlrs[j]; }}
free(evlrs);
evlrs = tmp;
//evlrs[i] = evlrs[number_of_extended_variable_length_records];
//evlrs = (LASevlr*)realloc(evlrs, sizeof(LASvlr)*number_of_extended_variable_length_records);
}
else
Expand Down

0 comments on commit b38aacc

Please sign in to comment.