[gnome-builder/gnome-builder-3-20] makecache: fix leak of duplicated makecache target
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/gnome-builder-3-20] makecache: fix leak of duplicated makecache target
- Date: Wed, 18 May 2016 11:56:06 +0000 (UTC)
commit a5be15526718ea676e4eb8e9e72a0da8f8e1f3b4
Author: Christian Hergert <chergert redhat com>
Date: Wed May 18 14:55:33 2016 +0300
makecache: fix leak of duplicated makecache target
plugins/autotools/ide-makecache-target.h | 2 ++
plugins/autotools/ide-makecache.c | 4 ++--
2 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/plugins/autotools/ide-makecache-target.h b/plugins/autotools/ide-makecache-target.h
index 5833d93..080e731 100644
--- a/plugins/autotools/ide-makecache-target.h
+++ b/plugins/autotools/ide-makecache-target.h
@@ -40,6 +40,8 @@ guint ide_makecache_target_hash (gconstpointer data);
gboolean ide_makecache_target_equal (gconstpointer data1,
gconstpointer data2);
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (IdeMakecacheTarget, ide_makecache_target_unref)
+
G_END_DECLS
#endif /* IDE_MAKECACHE_TARGET_H */
diff --git a/plugins/autotools/ide-makecache.c b/plugins/autotools/ide-makecache.c
index 67b5615..03b83f7 100644
--- a/plugins/autotools/ide-makecache.c
+++ b/plugins/autotools/ide-makecache.c
@@ -324,14 +324,14 @@ ide_makecache_get_file_targets_searched (GMappedFile *mapped,
if (is_target_interesting (targetstr))
{
- IdeMakecacheTarget *target;
+ g_autoptr(IdeMakecacheTarget) target = NULL;
target = ide_makecache_target_new (subdir, targetstr);
if (!g_hash_table_contains (found, target))
{
g_hash_table_insert (found, target, NULL);
- g_ptr_array_add (targets, target);
+ g_ptr_array_add (targets, g_steal_pointer (&target));
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]