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 5, 2024
1 parent 32112f7 commit d6eb8cd
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/celengine/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -613,8 +613,8 @@ Image* LoadPNGImage(const string& filename)
if (setjmp(png_jmpbuf(png_ptr)))
{
fclose(fp);
if (img != NULL)
delete img;
delete row_pointers;
delete img;
png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp) NULL);
clog << _("Error reading PNG image file ") << filename << '\n';
return NULL;
Expand Down Expand Up @@ -693,6 +693,7 @@ Image* LoadPNGImage(const string& filename)
png_read_image(png_ptr, row_pointers);

delete[] row_pointers;
row_pointers = NULL;

png_read_end(png_ptr, NULL);
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
Expand Down Expand Up @@ -806,7 +807,7 @@ static Image* LoadBMPImage(ifstream& in)
}
if (!readInteger(in, imageHeader.imageSize))
return NULL;

unsigned char* palette = NULL;
if (imageHeader.bpp == 8)
{
Expand Down

0 comments on commit d6eb8cd

Please sign in to comment.