Clean up ressources in test programs.

Helps clang's leak sanitizer.
diff --git a/regress/fseek.c b/regress/fseek.c
index 19f3c40..cba1033 100644
--- a/regress/fseek.c
+++ b/regress/fseek.c
@@ -1,6 +1,6 @@
 /*
   fseek.c -- test tool for seeking in zip archives
-  Copyright (C) 2016-2018 Dieter Baron and Thomas Klausner
+  Copyright (C) 2016-2019 Dieter Baron and Thomas Klausner
 
   This file is part of libzip, a library to manipulate ZIP archives.
   The authors can be contacted at <libzip@nih.at>
@@ -77,6 +77,7 @@
 
     if (zip_fseek(zf, offset, SEEK_SET) < 0) {
 	fprintf(stderr, "%s: zip_fseek failed: %s\n", progname, zip_error_strerror(zip_file_get_error(zf)));
+	zip_fclose(zf);
 	zip_close(z);
 	return 1;
     }
@@ -86,10 +87,16 @@
     }
     if (n < 0) {
 	fprintf(stderr, "%s: zip_fread failed: %s\n", progname, zip_error_strerror(zip_file_get_error(zf)));
+	zip_fclose(zf);
 	zip_close(z);
 	return 1;
     }
 
+    if (zip_fclose(zf) == -1) {
+	fprintf(stderr, "%s: can't close zip archive entry %" PRIu64 " in '%s': %s\n", progname, index, archive, zip_strerror(z));
+	return 1;
+    }
+
     if (zip_close(z) == -1) {
 	fprintf(stderr, "%s: can't close zip archive '%s': %s\n", progname, archive, zip_strerror(z));
 	return 1;
diff --git a/src/zipcmp.c b/src/zipcmp.c
index c452684..61c30ed 100644
--- a/src/zipcmp.c
+++ b/src/zipcmp.c
@@ -1,6 +1,6 @@
 /*
   zipcmp.c -- compare zip files
-  Copyright (C) 2003-2018 Dieter Baron and Thomas Klausner
+  Copyright (C) 2003-2019 Dieter Baron and Thomas Klausner
 
   This file is part of libzip, a library to manipulate ZIP archives.
   The authors can be contacted at <libzip@nih.at>
@@ -240,9 +240,18 @@
 	}
     }
 
-    for (i = 0; i < 2; i++)
-	if (a[i].za)
+    for (i = 0; i < 2; i++) {
+	int j;
+
+	if (a[i].za) {
 	    zip_close(a[i].za);
+	}
+	for (j = 0; j < a[i].nentry; j++) {
+	    free(a[i].entry[j].name);
+	    free(a[i].entry[j].extra_fields);
+	}
+	free(a[i].entry);
+    }
 
     switch (res) {
     case 0: