Clear have_next_byte when the source is closed. From PR #555
diff --git a/lib/zip_source_close.c b/lib/zip_source_close.c index 4603c6d..10fdc33 100644 --- a/lib/zip_source_close.c +++ b/lib/zip_source_close.c
@@ -43,6 +43,8 @@ src->open_count--; if (src->open_count == 0) { + src->have_next_byte = false; + _zip_source_call(src, NULL, 0, ZIP_SOURCE_CLOSE); if (ZIP_SOURCE_IS_LAYERED(src)) {
diff --git a/lib/zip_source_open.c b/lib/zip_source_open.c index 97c2378..4a11199 100644 --- a/lib/zip_source_open.c +++ b/lib/zip_source_open.c
@@ -65,10 +65,13 @@ } } + /* TODO: Move the next four lines to into the else branch above, or better yet to zip_source_close()? + They should probably only happen when ZIP_SOURCE_IS_OPEN_READING(src) changes, so other references that have the source open are not affected. */ src->eof = false; src->had_read_error = false; _zip_error_clear(&src->error); src->bytes_read = 0; + src->open_count++; return 0;