20190528-fix-leak-png_handle_exif.diff 602 B

1234567891011121314151617
  1. diff --git a/3rdparty/libpng/pngrutil.c b/3rdparty/libpng/pngrutil.c
  2. index d5fa08c397..4db3de990b 100644
  3. --- a/3rdparty/libpng/pngrutil.c
  4. +++ b/3rdparty/libpng/pngrutil.c
  5. @@ -2087,10 +2087,8 @@ png_handle_eXIf(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
  6. }
  7. }
  8. - if (png_crc_finish(png_ptr, 0) != 0)
  9. - return;
  10. -
  11. - png_set_eXIf_1(png_ptr, info_ptr, length, info_ptr->eXIf_buf);
  12. + if (png_crc_finish(png_ptr, 0) == 0)
  13. + png_set_eXIf_1(png_ptr, info_ptr, length, info_ptr->eXIf_buf);
  14. png_free(png_ptr, info_ptr->eXIf_buf);
  15. info_ptr->eXIf_buf = NULL;