Skip to content

Commit

Permalink
fix #67
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-Romain committed Dec 14, 2023
1 parent 3076c2d commit 5d02570
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/LASlib/lasdefinitions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -762,13 +762,8 @@ class LASheader : public LASquantizer, public LASattributer
number_of_extended_variable_length_records--;
if (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);
evlrs[i] = evlrs[number_of_extended_variable_length_records];
evlrs = (LASevlr*)realloc(evlrs, sizeof(LASevlr)*number_of_extended_variable_length_records);
}
else
{
Expand Down

0 comments on commit 5d02570

Please sign in to comment.