Commit Graph

32 Commits

Author SHA1 Message Date
Nirbheek Chauhan
884d989bd9 Merge branch '2136-option-context-suppressions' into 'master'
glib.supp: Suppress reachable leak of g_set_prgname() string

Closes #2136

See merge request GNOME/glib!1540
2020-06-17 20:03:21 +00:00
Philip Withnall
86d6e181c3 glib.supp: Suppress reachable leak of g_set_prgname() string
It’s set once and then used throughout the process lifetime.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Fixes: #2136
2020-06-17 19:31:22 +01:00
Emmanuele Bassi
99314b14b8 Add g_get_language_names_with_category() to the suppressions file
It's another one-off allocation, mostly triggered by GKeyFile.

Fixes: #2135
2020-06-17 12:48:04 +01:00
Philip Withnall
8bb04fb866 glib.supp: More reachable suppressions for threads and thread pools
Signed-off-by: Philip Withnall <withnall@endlessm.com>

Fixes: #2132
2020-06-17 11:46:27 +01:00
Philip Withnall
f18f7c9a21 glib.supp: Tweak reachable allocation suppressions
Suppress the cached charset from `g_get_charset()`, and widen the
suppression of the global random number `GRand` instance, since it can
be used outside test cases.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Fixes: #2134
2020-06-17 11:26:13 +01:00
Руслан Ижбулатов
a22a15dc5a GWin32RegistryKey: add MUI capabilities to get_value()
An extra argument to g_win32_registry_key_get_value_w() and
g_win32_registry_key_get_value() indicates that RegLoadMUIStringW()
should be used instead of RegQueryValueExW(). It only works on
strings, and automatically resolves resource strings (the ones
that start with "@").

The extra argument is needed to find resource DLLs that are only
specified by their relative name.
2020-05-20 14:23:49 +00:00
Philip Chimento
567caa9b29 glib.supp: Allow possible leaks of g_type_register_static()
It seems this should not only be marked reachable, but also for possible
leaks, as the realloc() variant already is.

https://gitlab.gnome.org/GNOME/glib/-/issues/1911
2020-05-02 10:20:43 -07:00
Guillaume Desmottes
484d08249e glib.supp: update g-threaded-resolver-getaddrinfo-config
This leak is now detected as 'definite' in newer version of Fedora,
see https://gitlab.freedesktop.org/gstreamer/gst-ci/merge_requests/226
2020-02-03 10:26:33 +05:30
Philip Withnall
e1cf40a6b2 glib.supp: Ignore the one-off GTask thread pool allocation
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-01-20 11:24:15 +00:00
Philip Withnall
c4cedf60f8 glib.supp: Allow definite leaks of g_main_context_push_thread_default()
If a transient worker thread calls it, the allocated memory is
definitely leaked when the thread exits. That’s intentional.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-11-12 15:32:05 +00:00
Philip Withnall
b97c57b502 glib.supp: Allow definite leaks of g_private_set_alloc0()
If a transient worker thread calls it, the allocated memory is
definitely leaked when the thread exits. That’s intentional.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-11-12 15:05:58 +00:00
Claudio Saavedra
9cc863e59a glib.supp: make gobject_init() calloc also of the possible kind
It's currently marked only as reachable but Valgrind also finds it as
possible:

==18842== 96 bytes in 1 blocks are possibly lost in loss record 2,029 of 2,284
==18842==    at 0x4837B65: calloc (vg_replace_malloc.c:762)
==18842==    by 0x49614AD: g_malloc0 (gmem.c:129)
==18842==    by 0x4A7013B: type_node_any_new_W (gtype.c:439)
==18842==    by 0x4A70609: type_node_fundamental_new_W (gtype.c:550)
==18842==    by 0x4A7855A: gobject_init (gtype.c:4406)
==18842==    by 0x4A78672: gobject_init_ctor (gtype.c:4493)
2019-09-04 16:36:39 +03:00
Sebastian Dröge
daa308dd6e Merge branch '487-ci-memcheck' into 'master'
Add CI job for running tests under Valgrind

Closes #487

See merge request GNOME/glib!169
2019-09-02 13:52:35 +00:00
Philip Withnall
8ae07a727a glib.supp: Add some fundamental type suppressions
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-09-02 14:16:33 +01:00
Philip Withnall
c8c75dc7ad glib.supp: Fix some indentation
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-09-02 14:16:33 +01:00
Philip Withnall
adb9264d12 glib.supp: Add leak types
Mark all the memcheck leaks as ‘reachable’, so the suppressions will not
apply if that memory is no longer reachable on exit(). This feature was
introduced in Valgrind 3.9, and is documented here:

http://valgrind.org/docs/manual/mc-manual.html#mc-manual.suppfiles

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-09-02 14:16:33 +01:00
Claudio Saavedra
6e4a02b9bc glib.supp: add suppression for g_type_class_ref()
This suppression is not caught by glib.supp, so add it:

==21145== 32 bytes in 1 blocks are possibly lost in loss record 1,456 of 2,584
==21145==    at 0x4837B65: calloc (vg_replace_malloc.c:762)
==21145==    by 0x495825E: g_malloc0 (gmem.c:129)
==21145==    by 0x4A6B6EB: type_class_init_Wm (gtype.c:2134)
==21145==    by 0x4A6D22A: g_type_class_ref (gtype.c:2950)
==21145==    by 0x4A6D1DD: g_type_class_ref (gtype.c:2942)
==21145==    by 0x4A5C9C6: g_param_spec_enum (gparamspecs.c:2085)
2019-08-30 09:27:31 +03:00
Philip Withnall
26934c6305 glib.supp: Add some missing suppressions for one-time allocations
Various memory allocations are still reachable when a process exits, as
they contain type system information which can’t be unloaded. Suppress
those using `glib.supp`.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Closes: #1879
2019-08-25 14:35:27 +03:00
Philip Withnall
49642bfeb2 glib.supp: Add a calloc() variant of an existing suppression
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-03-07 13:58:11 +00:00
Philip Chimento
e06fe748d0 glib.supp: Add more variations of existing suppressions
There are some cases where valgrind turns up leaks that are already
suppressed in the file, but with a slight difference at the top of the
stack. Add suppressions for these cases as well.
2019-02-24 22:10:36 -08:00
Philip Withnall
5beed066d1 glib.supp: Add suppressions from gsettings test
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-01-30 14:41:15 +00:00
Philip Withnall
140c2a225a glib.supp: Add a suppression for GMainContext default stacks
Since this uses a private GQueue, we can’t suppress this by using
g_private_set_alloc0().

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-01-07 18:54:17 +00:00
Philip Withnall
f6caeb6d1a gthread: Add g_private_set_alloc0() internal convenience API
This is a wrapper around g_private_set() which allocates the desired
amount of memory for the caller and calls g_private_set() on it.

This is intended to make it easier to suppress Valgrind warnings about
leaked memory, since g_private_set() is typically used to make one-time
per-thread allocations. We can now just add a blanket suppression rule
for any allocations inside g_private_set_alloc0().

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-01-07 18:54:17 +00:00
Philip Withnall
b4de2e3297 glib.supp: Add various one-time allocations to the suppression file
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-12-17 17:16:03 +00:00
Philip Withnall
91defdb34e gutils: Add internal API to override XDG directories
Add a new internal function, g_set_user_dirs(), which will safely
override the values returned by g_get_user_data_dir() and friends, and
the value returned by g_get_home_dir().

This is intended to be used by unit tests, and will be hooked up to them
in a following commit.

This can be called as many times as needed by the current process. It’s
thread-safe. It does not modify the environment, so none of the changes
are propagated to any subsequently spawned subprocesses.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/glib/issues/538
2018-12-17 17:16:03 +00:00
Philip Withnall
e6eb4869ba gutils: Refactor initialisation of XDG variables
Split out the code which calculates each XDG variable value from the
code which caches it, so that GLib can internally recalculate the
variables if needed, without necessarily trashing the user-visible
cache.

This will be useful in a following commit to add support for explicitly
reloading the variables.

This commit necessarily reworks how g_get_user_runtime_dir() is
structured, since it was inexplicably structured differently from (but
equivalently to) the other XDG variable functions.

Future refactoring could easily share a lot more code between these
g_build_*() functions.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/glib/issues/538
2018-12-17 17:16:03 +00:00
Philip Withnall
c2607ab321 glib.supp: Make a suppression less specific
Sometimes valgrind doesn’t count the calloc() call at the innermost
stack frame, and counts it as g_type_create_instance() instead.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-15 09:27:24 +00:00
Olivier Brunel
63e09d5251 valgrind: Add glib_init()-related suppressions 2018-10-31 19:43:59 +01:00
Philip Withnall
da44b78bef valgrind: Add more suppressions to glib.supp
These were spotted by running the entire test suite under valgrind,
thanks to the magic of Meson: see the build rules in valgrind-x86_64 in
.gitlab-ci.yml.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-06-29 13:55:24 +01:00
Olivier Crête
8e65417c6e docs: Change Bugzilla references to GitLab
Including modifications by Philip Withnall <withnall@endlessm.com>
2018-06-15 13:04:39 +01:00
Philip Chimento
a72f57eeab valgrind: Add false positive to suppressions file
Valgrind will check that the third argument to ioctl() is a valid
pointer, but some ioctls interpret that argument as an integer, and that
is the case here (it's a file descriptor), so this is a false positive.

https://bugzilla.gnome.org/show_bug.cgi?id=787109
2017-09-08 15:36:32 +01:00
Philip Withnall
a24f57b071 glib: Add installed Valgrind suppressions file for GLib and GIO
While we cannot get Valgrind to automatically load this suppression file
for applications which link to GLib
(https://bugs.kde.org/show_bug.cgi?id=160905), we can at least install
it on systems in a shared directory, so that developers can use a
standardised (and up-to-date) suppressions file for GLib, rather than
rolling their own.

The file will typically be installed to:
   /usr/share/glib-2.0/valgrind/glib.supp

Distributors: it is recommended that this suppression file be installed
as part of the development package for GLib in your distribution.

https://bugzilla.gnome.org/show_bug.cgi?id=666114
2016-11-23 10:45:56 +00:00