be_package: delay freeing archive resource
The error path uconditinally tries to free the archive, leading to a double-free segmentation fault if the error path is triggered after already freeing it. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
This commit is contained in:
parent
edd57c8b96
commit
fde59b99e8
1 changed files with 1 additions and 2 deletions
|
@ -652,8 +652,6 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle,
|
|||
goto pkg_invalid;
|
||||
}
|
||||
|
||||
_alpm_archive_read_free(archive);
|
||||
|
||||
/* internal fields for package struct */
|
||||
newpkg->origin = ALPM_PKG_FROM_FILE;
|
||||
STRDUP(newpkg->origin_data.file, pkgfile, goto error);
|
||||
|
@ -675,6 +673,7 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle,
|
|||
newpkg->infolevel |= INFRQ_FILES;
|
||||
}
|
||||
|
||||
_alpm_archive_read_free(archive);
|
||||
close(fd);
|
||||
return newpkg;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue