Skip to content

Commit

Permalink
Delete row_pointers array in png error handler
Browse files Browse the repository at this point in the history
  • Loading branch information
ajtribick committed Nov 2, 2024
1 parent 505517b commit ce2715b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/celimage/png.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ Image* LoadPNGImage(const fs::path& filename)
if (setjmp(png_jmpbuf(png_ptr)))
{
fclose(fp);
delete[] row_pointers;
delete img;
png_destroy_read_struct(&png_ptr, &info_ptr, nullptr);
util::GetLogger()->error(_("Error reading PNG image file {}\n"), filename);
Expand Down Expand Up @@ -255,6 +256,7 @@ Image* LoadPNGImage(const fs::path& filename)
png_read_image(png_ptr, row_pointers);

delete[] row_pointers;
row_pointers = nullptr;

png_read_end(png_ptr, nullptr);
png_destroy_read_struct(&png_ptr, &info_ptr, nullptr);
Expand Down

0 comments on commit ce2715b

Please sign in to comment.