summaryrefslogtreecommitdiff
path: root/src/pool.c
diff options
context:
space:
mode:
authorMichael Schroeder <mls@suse.de>2013-12-10 16:15:38 +0100
committerMichael Schroeder <mls@suse.de>2013-12-10 16:15:38 +0100
commitd66d76bdde309536289f4a755ee327c1e92b2fc4 (patch)
treeef180320c1a591531d42aeae13861199e49985ef /src/pool.c
parent60cb663d7567796f17d4218757ea087ed690e4b2 (diff)
downloadlibsolv-d66d76bdde309536289f4a755ee327c1e92b2fc4.tar.gz
libsolv-d66d76bdde309536289f4a755ee327c1e92b2fc4.tar.bz2
libsolv-d66d76bdde309536289f4a755ee327c1e92b2fc4.zip
fix double-free if the number of languages is reduced to zero
Diffstat (limited to 'src/pool.c')
-rw-r--r--src/pool.c9
1 files 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;