r20746 by jghali -

scribus-commit scribus-commit at lists.scribus.net
Fri Jan 29 20:34:37 UTC 2016


Author: jghali
Date: Fri Jan 29 20:34:37 2016
New Revision: 20746

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=20746
Log:
fix resource leak <coverity>

Modified:
    trunk/Scribus/scribus/plugins/import/ai/importai.cpp

Modified: trunk/Scribus/scribus/plugins/import/ai/importai.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20746&path=/trunk/Scribus/scribus/plugins/import/ai/importai.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/ai/importai.cpp	(original)
+++ trunk/Scribus/scribus/plugins/import/ai/importai.cpp	Fri Jan 29 20:34:37 2016
@@ -690,20 +690,23 @@
 	strm.opaque = Z_NULL;
 	strm.avail_in = 0;
 	strm.next_in = Z_NULL;
+
 	ret = inflateInit(&strm);
-
 	if (ret != Z_OK)
 	{
 		fclose(source);
 		fclose(dest);
 		return false;
 	}
+
 	do
 	{
 		strm.avail_in = fread(in, 1, 4096, source);
 		if (ferror(source))
 		{
 			(void)inflateEnd(&strm);
+			fclose(source);
+			fclose(dest);
 			return false;
 		}
 		if (strm.avail_in == 0)
@@ -722,12 +725,16 @@
 				case Z_DATA_ERROR:
 				case Z_MEM_ERROR:
 					(void)inflateEnd(&strm);
+					fclose(source);
+					fclose(dest);
 					return false;
 			}
 			have = 4096 - strm.avail_out;
 			if (fwrite(out, 1, have, dest) != have || ferror(dest))
 			{
 				(void)inflateEnd(&strm);
+				fclose(source);
+				fclose(dest);
 				return false;
 			}
 		}




More information about the scribus-commit mailing list