[libpng16] Revise contrib/oss-fuzz/libpng_read_fuzzer.cc

This commit is contained in:
Glenn Randers-Pehrson 2017-09-04 08:22:39 -05:00
parent 051d6cc19b
commit c77de19ba9

View File

@ -5,7 +5,7 @@
// Use of this source code is governed by a BSD-style license that may // Use of this source code is governed by a BSD-style license that may
// be found in the LICENSE file https://cs.chromium.org/chromium/src/LICENSE // be found in the LICENSE file https://cs.chromium.org/chromium/src/LICENSE
// Last changed in libpng 1.6.33beta02 [September 3, 2017] // Last changed in libpng 1.6.33beta02 [September 4, 2017]
// The modifications in 2017 by Glenn Randers-Pehrson include // The modifications in 2017 by Glenn Randers-Pehrson include
// 1. addition of a PNG_CLEANUP macro, // 1. addition of a PNG_CLEANUP macro,
@ -36,14 +36,12 @@ struct PngObjectHandler {
BufState* buf_state = nullptr; BufState* buf_state = nullptr;
~PngObjectHandler() { ~PngObjectHandler() {
if (png_handler.row_ptr) if (row_ptr)
png_free(png_handler.png_ptr, png_handler.row_ptr); png_free(png_ptr, row_ptr);
if (png_handler.end_info_ptr) if (end_info_ptr)
png_destroy_read_struct(&png_handler.png_ptr, &png_handler.info_ptr, png_destroy_read_struct(&png_ptr, &info_ptr, &end_info_ptr);
&png_handler.end_info_ptr); else if (info_ptr)
else if (png_handler.info_ptr) png_destroy_read_struct(&png_ptr, &info_ptr, nullptr);
png_destroy_read_struct(&png_handler.png_ptr, &png_handler.info_ptr,
nullptr);
else else
png_destroy_read_struct(&png_handler.png_ptr, nullptr, nullptr); png_destroy_read_struct(&png_handler.png_ptr, nullptr, nullptr);
delete buf_state; delete buf_state;