From d39c2b356cd6e8dd1f3c7778c7d49dfde3899f35 Mon Sep 17 00:00:00 2001
From: Xavier Chantry <shiningxc@gmail.com>
Date: Mon, 20 Jul 2009 14:52:16 +0200
Subject: [PATCH] Fix 2 minor memleaks

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
---
 lib/libalpm/conflict.c |    2 +-
 lib/libalpm/handle.c   |    1 +
 lib/libalpm/sync.c     |    1 +
 3 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/lib/libalpm/conflict.c b/lib/libalpm/conflict.c
index a6d50d4..07ef73c 100644
--- a/lib/libalpm/conflict.c
+++ b/lib/libalpm/conflict.c
@@ -534,7 +534,7 @@ alpm_list_t *_alpm_db_find_fileconflicts(pmdb_t *db, pmtrans_t *trans,
 			if(!resolved_conflict && dbpkg) {
 				char *rpath = calloc(PATH_MAX+1, sizeof(char));
 				if(!realpath(path, rpath)) {
-					free(rpath);
+					FREE(rpath);
 					continue;
 				}
 				char *filestr = rpath + strlen(handle->root);
diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c
index 4d341a8..34115b3 100644
--- a/lib/libalpm/handle.c
+++ b/lib/libalpm/handle.c
@@ -287,6 +287,7 @@ int SYMEXPORT alpm_option_set_root(const char *root)
 
 	realroot = calloc(PATH_MAX+1, sizeof(char));
 	if(!realpath(root, realroot)) {
+		FREE(realroot);
 		pm_errno = PM_ERR_NOT_A_DIR;
 		return(-1);
 	}
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 85186bb..ffcddf9 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -352,6 +352,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
 			/* Else, [resolved] now additionally contains [pkg] and all of its
 			   dependencies not already on the list */
 		}
+		alpm_list_free(preferred);
 
 		/* If there were unresolvable top-level packages, prompt the user to
 		   see if they'd like to ignore them rather than failing the sync */
-- 
1.6.1.2

