summaryrefslogtreecommitdiff
path: root/pngstruct.h
diff options
context:
space:
mode:
authorCosmin Truta <ctruta@gmail.com>2019-02-03 19:51:18 -0500
committerCosmin Truta <ctruta@gmail.com>2019-02-03 19:51:18 -0500
commit70d122aac42933ab8a708c538f973c3307853212 (patch)
treeb867b2e9567c0c0b7f0cb8d5730999e4def8b5f7 /pngstruct.h
parent0a882b57876776ab7c46f13cf170b8d376036a6a (diff)
Fix a memory leak in the riffled palette optimization on ARM; refactor
Move deallocation of riffled_palette from png_write_destroy to png_read_destroy. The reader (not the writer) is the owner of riffled_palette. Move allocation and initialization of riffled_palette from png_do_read_transformations to png_init_palette_transformations. Allow riffled_palette inside png_struct only if the ARM Neon optimizations are enabled. Rename png_riffle_palette_rgba to png_riffle_palette_rgba8, etc., to better indicate the strict applicability of these routines. Fix an unused parameter warning in the build configurations where riffled palette optimization is not enabled. Fix indentation.
Diffstat (limited to 'pngstruct.h')
-rw-r--r--pngstruct.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/pngstruct.h b/pngstruct.h
index 94a6d041f..8bdc7ce46 100644
--- a/pngstruct.h
+++ b/pngstruct.h
@@ -1,7 +1,7 @@
/* pngstruct.h - header file for PNG reference library
*
- * Copyright (c) 2018 Cosmin Truta
+ * Copyright (c) 2018-2019 Cosmin Truta
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
* Copyright (c) 1996-1997 Andreas Dilger
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
@@ -228,10 +228,6 @@ struct png_struct_def
* big_row_buf; while writing it is separately
* allocated.
*/
-#ifdef PNG_READ_EXPAND_SUPPORTED
- /* Buffer to accelerate palette transformations. */
- png_bytep riffled_palette;
-#endif
#ifdef PNG_WRITE_FILTER_SUPPORTED
png_bytep try_row; /* buffer to save trial row when filtering */
png_bytep tst_row; /* buffer to save best trial row when filtering */
@@ -396,6 +392,12 @@ struct png_struct_def
/* deleted in 1.5.5: rgb_to_gray_blue_coeff; */
#endif
+/* New member added in libpng-1.6.36 */
+#if defined(PNG_READ_EXPAND_SUPPORTED) && \
+ defined(PNG_ARM_NEON_IMPLEMENTATION)
+ png_bytep riffled_palette; /* buffer for accelerated palette expansion */
+#endif
+
/* New member added in libpng-1.0.4 (renamed in 1.0.9) */
#if defined(PNG_MNG_FEATURES_SUPPORTED)
/* Changed from png_byte to png_uint_32 at version 1.2.0 */