gvarianttypeinfo: Mark one-off leaks as ignored

These two data structures are allocated once and live for the lifetime
of the process, and are leaked on exit. That’s fine, and intentional.
Add `g_ignore_leak()` to them to make that a bit clearer, and
communicate the intent to asan.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3472
This commit is contained in:
Philip Withnall 2024-10-10 12:37:04 +01:00
parent 67532b4555
commit 0175b5ff12
No known key found for this signature in database
GPG Key ID: DCDF5885B1F3ED73

View File

@ -31,6 +31,7 @@
#include <glib/ghash.h>
#include <glib/grefcount.h>
#include "glib-private.h"
#include "glib_trace.h"
/* < private >
@ -800,8 +801,11 @@ g_variant_type_info_get (const GVariantType *type)
g_rec_mutex_lock (&g_variant_type_info_lock);
if (g_variant_type_info_table == NULL)
g_variant_type_info_table = g_hash_table_new ((GHashFunc)_g_variant_type_hash,
(GEqualFunc)_g_variant_type_equal);
{
g_variant_type_info_table = g_hash_table_new ((GHashFunc)_g_variant_type_hash,
(GEqualFunc)_g_variant_type_equal);
g_ignore_leak (g_variant_type_info_table);
}
info = g_hash_table_lookup (g_variant_type_info_table, type_string);
if (info == NULL)
@ -895,7 +899,10 @@ g_variant_type_info_unref (GVariantTypeInfo *info)
if (g_atomic_ref_count_dec (&container->ref_count))
{
if (g_variant_type_info_gc == NULL)
g_variant_type_info_gc = g_ptr_array_new ();
{
g_variant_type_info_gc = g_ptr_array_new ();
g_ignore_leak (g_variant_type_info_gc);
}
/* Steal this instance and place it onto the GC queue.
* We may bring it back to life before the next GC.