mirror of
https://github.com/flatpak/flatpak.git
synced 2026-02-01 11:31:21 -05:00
dir: Don't store a pointer in a gsize
This is, strictly speaking, not allowed. On uncommon architectures like CHERI, a pointer can be larger than a gsize. This might also help to avoid AddressSanitizer losing track of reachability, so that it won't think the array and its contents have been leaked. Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
@@ -1842,16 +1842,16 @@ GPtrArray *
|
||||
flatpak_get_system_base_dir_locations (GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
static gsize array = 0;
|
||||
static gsize initialized = 0;
|
||||
static GPtrArray *array = NULL;
|
||||
|
||||
if (g_once_init_enter (&array))
|
||||
if (g_once_init_enter (&initialized))
|
||||
{
|
||||
gsize setup_value = 0;
|
||||
setup_value = (gsize) get_system_locations (cancellable, error);
|
||||
g_once_init_leave (&array, setup_value);
|
||||
array = get_system_locations (cancellable, error);
|
||||
g_once_init_leave (&initialized, 1);
|
||||
}
|
||||
|
||||
return (GPtrArray *) array;
|
||||
return array;
|
||||
}
|
||||
|
||||
GFile *
|
||||
|
||||
Reference in New Issue
Block a user