summaryrefslogtreecommitdiff
path: root/ext/zip/lib/zip_close.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/zip/lib/zip_close.c')
-rw-r--r--ext/zip/lib/zip_close.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/ext/zip/lib/zip_close.c b/ext/zip/lib/zip_close.c
index 289ca7afb3..7f93cc94e1 100644
--- a/ext/zip/lib/zip_close.c
+++ b/ext/zip/lib/zip_close.c
@@ -229,11 +229,10 @@ zip_close(struct zip *za)
zs = NULL;
if (!ZIP_ENTRY_DATA_CHANGED(za->entry+i)) {
- if ((zs=zip_source_zip(za, za, i, ZIP_FL_RECOMPRESS, 0, -1))
- == NULL) {
- error = 1;
- break;
- }
+ if ((zs=zip_source_zip(za, za, i, ZIP_FL_RECOMPRESS, 0, -1)) == NULL) {
+ error = 1;
+ break;
+ }
}
if (add_data(za, zs ? zs : za->entry[i].source, &de, out) < 0) {
@@ -286,19 +285,19 @@ zip_close(struct zip *za)
return -1;
}
- if (za->zp) {
- fclose(za->zp);
- za->zp = NULL;
- reopen_on_error = 1;
+ if (za->zp) {
+ fclose(za->zp);
+ za->zp = NULL;
+ reopen_on_error = 1;
}
if (_zip_rename(temp, za->zn) != 0) {
_zip_error_set(&za->error, ZIP_ER_RENAME, errno);
remove(temp);
free(temp);
- if (reopen_on_error) {
- /* ignore errors, since we're already in an error case */
- za->zp = fopen(za->zn, "rb");
- }
+ if (reopen_on_error) {
+ /* ignore errors, since we're already in an error case */
+ za->zp = fopen(za->zn, "rb");
+ }
return -1;
}
mask = umask(0);
@@ -638,7 +637,7 @@ _zip_create_temp_output(struct zip *za, FILE **outp)
FILE *tfp;
int len = strlen(za->zn) + 8;
- if ((temp=(char *)malloc(strlen(za->zn)+8)) == NULL) {
+ if ((temp=(char *)malloc(len)) == NULL) {
_zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
return NULL;
}