From 5e52dc09068e6f1f447581f0c3d85f359c6ea144 Mon Sep 17 00:00:00 2001 From: morganamilo Date: Fri, 27 Jan 2023 01:54:04 +0000 Subject: [PATCH] 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. --- lib/libalpm/alpm.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c index d0c04a03..2ae89186 100644 --- a/lib/libalpm/alpm.c +++ b/lib/libalpm/alpm.c @@ -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) {