summaryrefslogtreecommitdiffstats
path: root/f8ef1a2c7855c0b5dbf7de32269cc7633eb620bd.patch
blob: 9f5b71a26a29a781b577a88f30766ad02c62ebde (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
From f8ef1a2c7855c0b5dbf7de32269cc7633eb620bd Mon Sep 17 00:00:00 2001
From: Dieter Baron <dillo@nih.at>
Date: Mon, 20 Nov 2017 09:23:02 +0100
Subject: [PATCH] Do not discard za in case of error.

Fixes serious bug introduced in 1.3.1.
---
 lib/zip_close.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/zip_close.c b/lib/zip_close.c
index 71f4bf7..2aff0dd 100644
--- a/lib/zip_close.c
+++ b/lib/zip_close.c
@@ -216,15 +216,16 @@ zip_close(zip_t *za)
 	}
     }
 
+    _zip_progress_end(za->progress);
+
     if (error) {
 	zip_source_rollback_write(za->src);
+        return -1;
     }
 
-    _zip_progress_end(za->progress);
-
     zip_discard(za);
-    
-    return error ? -1 : 0;
+
+    return 0;
 }