Skip to content

Commit

Permalink
fix: add two missing delete[] calls
Browse files Browse the repository at this point in the history
  • Loading branch information
LandscapeLab Office committed Feb 21, 2024
1 parent 4a2dc7b commit 19885a4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/geodata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,9 @@ float GeoRasterLayer::get_value_at_position_with_resolution(double pos_x, double
if (raster->get_format() == GeoRaster::FORMAT::RF) {
float *array = (float *)raster->get_as_array();

return array[0];
float value = array[0];
delete[] array;
return value;
}

return -1.0;
Expand Down
2 changes: 2 additions & 0 deletions src/geoimage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,8 @@ Ref<HeightMapShape3D> GeoImage::get_shape_for_heightmap() {
// Copy all bytes from the raw raster array into the PackedFloat32Array
memcpy(array.ptrw(), data, raster->get_pixel_size_x() * raster->get_pixel_size_y() * 4);

delete[] data;

shape->set_map_width(raster->get_pixel_size_x());
shape->set_map_depth(raster->get_pixel_size_y());
shape->set_map_data(array);
Expand Down

0 comments on commit 19885a4

Please sign in to comment.