From d66d76bdde309536289f4a755ee327c1e92b2fc4 Mon Sep 17 00:00:00 2001 From: Michael Schroeder Date: Tue, 10 Dec 2013 16:15:38 +0100 Subject: [PATCH] fix double-free if the number of languages is reduced to zero --- src/pool.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/pool.c b/src/pool.c index 910a9c1..24a7fb4 100644 --- a/src/pool.c +++ b/src/pool.c @@ -1661,12 +1661,9 @@ pool_set_languages(Pool *pool, const char **languages, int nlanguages) pool->languagecache = solv_free(pool->languagecache); pool->languagecacheother = 0; - if (pool->nlanguages) - { - for (i = 0; i < pool->nlanguages; i++) - free((char *)pool->languages[i]); - free(pool->languages); - } + for (i = 0; i < pool->nlanguages; i++) + free((char *)pool->languages[i]); + pool->languages = solv_free(pool->languages); pool->nlanguages = nlanguages; if (!nlanguages) return; -- 2.7.4