1diff --git a/third_party/libtiff/tif_getimage.c b/third_party/libtiff/tif_getimage.c
2index 97fa94d..1cf6ac6 100644
3--- a/third_party/libtiff/tif_getimage.c
4+++ b/third_party/libtiff/tif_getimage.c
5@@ -267,6 +267,13 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int stop, char emsg[1024])
6        img->redcmap = NULL;
7        img->greencmap = NULL;
8        img->bluecmap = NULL;
9+       img->Map = NULL;
10+       img->BWmap = NULL;
11+       img->PALmap = NULL;
12+       img->ycbcr = NULL;
13+       img->cielab = NULL;
14+       img->UaToAa = NULL;
15+       img->Bitdepth16To8 = NULL;
16        img->req_orientation = ORIENTATION_BOTLEFT;     /* It is the default */
17 
18        img->tif = tif;
19@@ -452,13 +459,6 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int stop, char emsg[1024])
20                            photoTag, img->photometric);
21                         goto fail_return;
22        }
23-       img->Map = NULL;
24-       img->BWmap = NULL;
25-       img->PALmap = NULL;
26-       img->ycbcr = NULL;
27-       img->cielab = NULL;
28-       img->UaToAa = NULL;
29-       img->Bitdepth16To8 = NULL;
30        TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &img->width);
31        TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &img->height);
32        TIFFGetFieldDefaulted(tif, TIFFTAG_ORIENTATION, &img->orientation);
33@@ -478,7 +478,7 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int stop, char emsg[1024])
34        return 1;
35 
36   fail_return:
37-        TIFFRGBAImageEnd(img);
38+        TIFFRGBAImageEnd( img );
39         return 0;
40 }
41