Blob Blame History Raw
diff --git a/tools/ppm2tiff.c b/tools/ppm2tiff.c
index 81ffa3d..a02e865 100644
--- a/tools/ppm2tiff.c
+++ b/tools/ppm2tiff.c
@@ -285,6 +285,8 @@ main(int argc, char* argv[])
 		if (TIFFWriteScanline(out, buf, row, 0) < 0)
 			break;
 	}
+	if (in != stdin)
+		fclose(in);
 	(void) TIFFClose(out);
 	if (buf)
 		_TIFFfree(buf);
diff --git a/tools/tiff2pdf.c b/tools/tiff2pdf.c
index bd23c9e..a15a3ef 100644
--- a/tools/tiff2pdf.c
+++ b/tools/tiff2pdf.c
@@ -3020,6 +3020,7 @@ tsize_t t2p_readwrite_pdf_image_tile(T2P* t2p, TIFF* input, TIFF* output, ttile_
                                         "for t2p_readwrite_pdf_image_tile, %s", 
 					(unsigned long) t2p->tiff_datasize, 
 					TIFFFileName(input));
+				_TIFFfree(buffer);
 				t2p->t2p_error = T2P_ERR_ERROR;
 				return(0);
 			}
@@ -3747,11 +3748,11 @@ t2p_sample_rgbaa_to_rgb(tdata_t data, uint32 samplecount)
 {
 	uint32 i;
 	
-    /* For the 3 first samples, there is overlapping between souce and
-       destination, so use memmove().
-       See http://bugzilla.maptools.org/show_bug.cgi?id=2577 */
-    for(i = 0; i < 3 && i < samplecount; i++)
-        memmove((uint8*)data + i * 3, (uint8*)data + i * 4, 3);
+	/* For the 3 first samples, there is overlapping between souce and
+	   destination, so use memmove().
+	   See http://bugzilla.maptools.org/show_bug.cgi?id=2577 */
+	for(i = 0; i < 3 && i < samplecount; i++)
+		memmove((uint8*)data + i * 3, (uint8*)data + i * 4, 3);
 	for(; i < samplecount; i++)
 		memcpy((uint8*)data + i * 3, (uint8*)data + i * 4, 3);