Skip to content

Commit 3cd08fb

Browse files
authored
Merge pull request #504 from ktakahashimtb/ktakahashimtb/close-handle
Close handle from FindFirstFile call
2 parents 8128760 + 8613a07 commit 3cd08fb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/zip_source_file_win32_named.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,11 @@ _zip_win32_named_op_stat(zip_source_file_context_t *ctx, zip_source_file_stat_t
213213
if (file_attributes.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) {
214214
WIN32_FIND_DATA find_data;
215215
/* Deduplication on Windows replaces files with reparse points;
216-
* accept them as regular files. */
217-
if (file_ops->find_first_file(ctx->fname, &find_data) != INVALID_HANDLE_VALUE) {
216+
* accept them as regular files. */
217+
HANDLE find_handle = file_ops->find_first_file(ctx->fname, &find_data);
218+
if (find_handle != INVALID_HANDLE_VALUE) {
218219
st->regular_file = (find_data.dwReserved0 == IO_REPARSE_TAG_DEDUP);
220+
FindClose(find_handle);
219221
}
220222
}
221223
else {

0 commit comments

Comments
 (0)