Commit da830429 for libheif
commit da830429b3d4a5269ba4d09c1c05de71ec15a257
Author: Dirk Farin <dirk.farin@gmail.com>
Date: Fri May 15 01:20:30 2026 +0200
Release the old plane buffer when reallocating in extend_padding/extend_to_size
diff --git a/libheif/image/pixelimage.cc b/libheif/image/pixelimage.cc
index 8e4bff80..b13a18dc 100644
--- a/libheif/image/pixelimage.cc
+++ b/libheif/image/pixelimage.cc
@@ -536,6 +536,11 @@ Error HeifPixelImage::extend_padding_to_size(uint32_t width, uint32_t height, bo
component.m_width * bytes_per_pixel);
}
+ // --- release the old plane before replacing it with the reallocated plane
+
+ m_memory_handle.free(component.allocation_size);
+ delete[] component.allocated_mem;
+
component = newPlane;
}
@@ -622,8 +627,9 @@ Error HeifPixelImage::extend_to_size_with_zero(uint32_t width, uint32_t height,
component.m_width * bytes_per_pixel);
}
- // --- replace existing image plane with reallocated plane
+ // --- release the old plane before replacing it with the reallocated plane
+ m_memory_handle.free(component.allocation_size);
delete[] component.allocated_mem;
component = newPlane;