summaryrefslogtreecommitdiff
path: root/ext/zip/lib/zip_unchange.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/zip/lib/zip_unchange.c')
-rw-r--r--ext/zip/lib/zip_unchange.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/ext/zip/lib/zip_unchange.c b/ext/zip/lib/zip_unchange.c
index 7366c9cc71..550e8b9903 100644
--- a/ext/zip/lib/zip_unchange.c
+++ b/ext/zip/lib/zip_unchange.c
@@ -40,7 +40,7 @@
ZIP_EXTERN(int)
-zip_unchange(struct zip *za, int idx)
+zip_unchange(struct zip *za, zip_uint64_t idx)
{
return _zip_unchange(za, idx, 0);
}
@@ -48,11 +48,11 @@ zip_unchange(struct zip *za, int idx)
int
-_zip_unchange(struct zip *za, int idx, int allow_duplicates)
+_zip_unchange(struct zip *za, zip_uint64_t idx, int allow_duplicates)
{
int i;
- if (idx < 0 || idx >= za->nentry) {
+ if (idx >= za->nentry) {
_zip_error_set(&za->error, ZIP_ER_INVAL, 0);
return -1;
}
@@ -72,6 +72,9 @@ _zip_unchange(struct zip *za, int idx, int allow_duplicates)
za->entry[idx].ch_filename = NULL;
}
+ free(za->entry[idx].ch_extra);
+ za->entry[idx].ch_extra = NULL;
+ za->entry[idx].ch_extra_len = -1;
free(za->entry[idx].ch_comment);
za->entry[idx].ch_comment = NULL;
za->entry[idx].ch_comment_len = -1;