The POSIX and Windows code did not check the result of
archive_entry_clone. Handle this error condition properly.
While at it, unify POSIX and Windows code a bit.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
a->pst = NULL;
a->current_fixup = NULL;
a->deferred = 0;
- if (a->entry) {
- archive_entry_free(a->entry);
- a->entry = NULL;
- }
+ archive_entry_free(a->entry);
a->entry = archive_entry_clone(entry);
+ if (a->entry == NULL) {
+ archive_set_error(&a->archive, ENOMEM, "Out of memory");
+ return (ARCHIVE_FATAL);
+ }
a->fd = -1;
a->fd_offset = 0;
a->offset = 0;
a->current_fixup = NULL;
a->deferred = 0;
archive_entry_free(a->entry);
- a->entry = NULL;
a->entry = archive_entry_clone(entry);
+ if (a->entry == NULL) {
+ archive_set_error(&a->archive, ENOMEM, "Out of memory");
+ return (ARCHIVE_FATAL);
+ }
a->fh = INVALID_HANDLE_VALUE;
a->fd_offset = 0;
a->offset = 0;