Merge pull request #3125 from stoeckmann/disk_clone
Check allocation in `_archive_write_disk_header`
(cherry picked from commit 2b21f5a6cc)
This commit is contained in:
1 parent
5eb060231f
commit
47926b95a9
2 files changed
+9
-5
No files matched your search
@@ -600,11 +600,12 @@ _archive_write_disk_header(struct archive *_a, struct archive_entry *entry)
|
||||
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;
|
||||
|
||||
@@ -859,8 +859,11 @@ _archive_write_disk_header(struct archive *_a, struct archive_entry *entry)
|
||||
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;
|
||||
|
||||
Reference in new issue
Block a user