From 95693f78fc992ec7f995b8b36fc3721cd85c2f3e Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Thu, 23 Nov 2023 23:22:01 +0000 Subject: [PATCH] girepository: Fix a minor string leak Caught by the new unit tests. Signed-off-by: Philip Withnall --- girepository/girepository.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/girepository/girepository.c b/girepository/girepository.c index b0ecaea42..1acfff26d 100644 --- a/girepository/girepository.c +++ b/girepository/girepository.c @@ -129,7 +129,7 @@ gi_repository_init (GIRepository *repository) repository->priv = gi_repository_get_instance_private (repository); repository->priv->typelibs = g_hash_table_new_full (g_str_hash, g_str_equal, - (GDestroyNotify) NULL, + (GDestroyNotify) g_free, (GDestroyNotify) gi_typelib_free); repository->priv->lazy_typelibs = g_hash_table_new_full (g_str_hash, g_str_equal, @@ -441,7 +441,9 @@ register_internal (GIRepository *repository, else key = build_typelib_key (namespace, source); - g_hash_table_insert (repository->priv->typelibs, key, (void *)typelib); + g_hash_table_insert (repository->priv->typelibs, + g_steal_pointer (&key), + (void *)typelib); } /* These types might be resolved now, clear the cache */