1diff a/third_party/libpng16/pngmem.c b/third_party/libpng16/pngmem.c
2--- a/third_party/libpng16/pngmem.c
3+++ b/third_party/libpng16/pngmem.c
4@@ -19,6 +19,9 @@
5
6 #include "pngpriv.h"
7
8+void*	FXMEM_DefaultAlloc(int byte_size, int);
9+void	FXMEM_DefaultFree(void* pointer, int);
10+
11 #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
12 /* Free a png_struct */
13 void /* PRIVATE */
14@@ -92,7 +95,7 @@
15
16       else
17 #endif
18-         return malloc((size_t)size); /* checked for truncation above */
19+         return FXMEM_DefaultAlloc((int)size, 0);
20    }
21
22    else
23@@ -249,7 +252,7 @@
24       return;
25 #endif /* USER_MEM */
26
27-   free(ptr);
28+   FXMEM_DefaultFree(ptr, 0);
29 }
30
31 #ifdef PNG_USER_MEM_SUPPORTED
32diff a/third_party/libpng16/pngstruct.h b/third_party/libpng16/pngstruct.h
33--- a/third_party/libpng16/pngstruct.h
34+++ b/third_party/libpng16/pngstruct.h
35@@ -27,7 +27,7 @@
36    /* We must ensure that zlib uses 'const' in declarations. */
37 #  define ZLIB_CONST
38 #endif
39-#include "zlib.h"
40+#include "third_party/zlib_v128/zlib.h"
41 #ifdef const
42    /* zlib.h sometimes #defines const to nothing, undo this. */
43 #  undef const
44