libtiff: tiffsplit.c: fix use after free introduced in master per commit 8ed97f401552a2b4300d3c489b03dcada86a21fd (related to #290)

https://github.com/libsdl-org/libtiff/commit/01c68b6ce04d47386b67a6560641b6a3932ca2cc

From 01c68b6ce04d47386b67a6560641b6a3932ca2cc Mon Sep 17 00:00:00 2001
From: Even Rouault <[EMAIL REDACTED]>
Date: Sat, 19 Feb 2022 17:31:55 +0100
Subject: [PATCH] tiffsplit.c: fix use after free introduced in master per
 commit 8ed97f401552a2b4300d3c489b03dcada86a21fd (related to #290)

---
 tools/tiffsplit.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/tiffsplit.c b/tools/tiffsplit.c
index f3d09d84..d4978c70 100644
--- a/tools/tiffsplit.c
+++ b/tools/tiffsplit.c
@@ -149,13 +149,14 @@ main(int argc, char* argv[])
 		path[path_len - 1] = '\0';
 		strncat(path, TIFF_SUFFIX, path_len - strlen(path) - 1);
 		out = TIFFOpen(path, TIFFIsBigEndian(in) ? "wb" : "wl");
-		_TIFFfree(path);
 
 		if (out == NULL) {
 			TIFFClose(in);
 			fprintf(stderr, "tiffsplit: Error: Could not open output file %s \n", path);
+			_TIFFfree(path);
 			return (EXIT_FAILURE);
 		}
+		_TIFFfree(path);
 		if (!tiffcp(in, out)) {
 			TIFFClose(in);
 			TIFFClose(out);