1
0
forked from mirrors/pacman

Compare commits

...

2 Commits

Author SHA1 Message Date
morganamilo
5e52dc0906 libalpm: free trans before databases
When releasing the handle, alpm tries to do some self clean up by
freeing the databases and transaction.

However, databases refuse to unregister is there is an in progress
transaction. Causing them to leak if the handle is released while
a transaction is active.
2023-09-20 14:59:39 +01:00
morganamilo
015cdb21bd Fix unused variable warning 2023-09-20 04:32:21 +01:00
2 changed files with 7 additions and 2 deletions

View File

@@ -415,7 +415,7 @@ static int extract_single_file(alpm_handle_t *handle, struct archive *archive,
static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg,
size_t pkg_current, size_t pkg_count)
{
int i, ret = 0, errors = 0;
int ret = 0, errors = 0;
int is_upgrade = 0;
alpm_pkg_t *oldpkg = NULL;
alpm_db_t *db = handle->db_local;
@@ -538,7 +538,7 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg,
/* call PROGRESS once with 0 percent, as we sort-of skip that here */
PROGRESS(handle, progress, newpkg->name, 0, pkg_count, pkg_current);
for(i = 0; archive_read_next_header(archive, &entry) == ARCHIVE_OK; i++) {
while(archive_read_next_header(archive, &entry) == ARCHIVE_OK) {
int percent;
if(newpkg->size != 0) {

View File

@@ -100,6 +100,11 @@ int SYMEXPORT alpm_release(alpm_handle_t *myhandle)
CHECK_HANDLE(myhandle, return -1);
/* free transaction memory */
if(myhandle->trans && alpm_trans_release(myhandle) == -1) {
return -1;
}
/* close local database */
db = myhandle->db_local;
if(db) {