From ab506f77c04a481782d9e53c6a285227f58f5cf7 Mon Sep 17 00:00:00 2001
From: Chantry Xavier <shiningxc@gmail.com>
Date: Sun, 13 Jan 2008 01:55:08 +0100
Subject: util.c : fix segfault when the cachedir isn't usable.

For example, if the cachedir is a broken symlink or a non writable
directory, pacman fallbacks to /tmp/. Just before doing that, it freed the
handle->cachedirs list twice !
once in _alpm_filecache_setup, and once in alpm_option_set_cachedirs. So the
first one was removed.

Fixes FS#9186.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
---
 lib/libalpm/util.c | 2 --
 1 file changed, 2 deletions(-)

(limited to 'lib/libalpm')

diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index 64006d1f..d09b9b14 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -582,9 +582,7 @@ const char *_alpm_filecache_setup(void)
 	}
 
 	/* we didn't find a valid cache directory. use /tmp. */
-	i = alpm_option_get_cachedirs();
 	tmp = alpm_list_add(NULL, strdup("/tmp/"));
-	FREELIST(i);
 	alpm_option_set_cachedirs(tmp);
 	_alpm_log(PM_LOG_DEBUG, "using cachedir: %s", "/tmp/\n");
 	_alpm_log(PM_LOG_WARNING, _("couldn't create package cache, using /tmp instead\n"));
-- 
cgit v1.2.3-70-g09d2