diff --git a/src/common/PNGLibrary.cxx b/src/common/PNGLibrary.cxx index 874bab478..1d9ae2c1b 100644 --- a/src/common/PNGLibrary.cxx +++ b/src/common/PNGLibrary.cxx @@ -304,7 +304,7 @@ void PNGLibrary::writeComments(png_structp png_ptr, png_infop info_ptr, if(numComments == 0) return; - png_text text_ptr[numComments]; + unique_ptr text_ptr = make_ptr(numComments); for(uInt32 i = 0; i < numComments; ++i) { text_ptr[i].key = (char*) comments[i].first.c_str(); @@ -312,7 +312,7 @@ void PNGLibrary::writeComments(png_structp png_ptr, png_infop info_ptr, text_ptr[i].compression = PNG_TEXT_COMPRESSION_NONE; text_ptr[i].text_length = 0; } - png_set_text(png_ptr, info_ptr, text_ptr, numComments); + png_set_text(png_ptr, info_ptr, text_ptr.get(), numComments); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -