[pacman-dev] [PATCH 3/4] be_sync.c: Fix memory leak in alpm_db_update()

Lukas Fleischer archlinux at cryptocrack.de
Fri Aug 26 07:10:37 EDT 2011


Free "syncpath" and restore umask if we fail to grab a lock.

Signed-off-by: Lukas Fleischer <archlinux at cryptocrack.de>
---
 lib/libalpm/be_sync.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c
index 6e64e5f..5e53798 100644
--- a/lib/libalpm/be_sync.c
+++ b/lib/libalpm/be_sync.c
@@ -176,6 +176,8 @@ int SYMEXPORT alpm_db_update(int force, alpm_db_t *db)
 
 	/* attempt to grab a lock */
 	if(_alpm_handle_lock(handle)) {
+		free(syncpath);
+		umask(oldmask);
 		RET_ERR(handle, ALPM_ERR_HANDLE_LOCK, -1);
 	}
 
-- 
1.7.6.1



More information about the pacman-dev mailing list