Skip to content

Commit df68049

Browse files
committed
Image texture dtor should call STBI_FREE(data)
because the `stbi_load` function uses `STBI_MALLOC`. Resolves #734
1 parent 20987fb commit df68049

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Change Log -- Ray Tracing in One Weekend
77
- Change: Refactored dielectric class for clarity
88
- Fix: Update local Markdeep library (for offline reading) to v1.11. The prior version had
99
incorrect content (#712)
10+
- Fix: Image texture destructor should call `STBI_FREE` instead of delete (#734)
1011

1112
### _In One Weekend_
1213
- Delete: Remove premature `cstdlib` include; not needed until we use `rand()` (#687)

src/common/texture.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ class image_texture : public texture {
105105
}
106106

107107
~image_texture() {
108-
delete data;
108+
STBI_FREE(data);
109109
}
110110

111111
virtual color value(double u, double v, const vec3& p) const override {

0 commit comments

Comments
 (0)