File 0025-Fixed-bug-that-left-file-open-in-scanner-when-invali.patch of Package stargus

From 863282b71aed465ab93cc43fa825dec72ba4013d Mon Sep 17 00:00:00 2001
From: Hypexed <hypexed@yahoo.com.au>
Date: Sun, 28 May 2017 22:54:39 +1000
Subject: [PATCH 25/26] Fixed bug that left file open in scanner when invalid
 archive was found. Rearranged resource freeing order in PNG saver.

---
 startool.cpp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/startool.cpp b/startool.cpp
index 05bd31f..3e7599d 100644
--- a/startool.cpp
+++ b/startool.cpp
@@ -2774,10 +2774,11 @@ int SavePNG(const char *name, unsigned char *image, int w, int h,
 	png_write_end(png_ptr, info_ptr);
 
 	png_destroy_write_struct(&png_ptr, &info_ptr);
-	fclose(fp);
-
+		
 	free(lines);
 
+	fclose(fp);
+
 	return 0;
 }
 
@@ -2804,6 +2805,8 @@ int OpenArchive(const char *file)
 
 	if (Mpq->ReadInfo(MpqFD, listfile)) {
 		printf("MpqReadInfo failed\n");
+		fclose(MpqFD);
+		MpqFD = NULL;
 		return -1;
 	}
 
-- 
2.16.4

openSUSE Build Service is sponsored by