mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-22 18:22:11 +01:00
gthread: Mark data allocated with g_private_set_alloc0 as leaking
This is what we already ignored with valgrind and it's something that we should always ignore since it's leaked by design. So do explicitly mark it as such.
This commit is contained in:
parent
c91dc83fb0
commit
a04163d8ac
@ -40,6 +40,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "glib-private.h"
|
||||
#include "gthread.h"
|
||||
#include "gthreadprivate.h"
|
||||
|
||||
@ -505,10 +506,10 @@ static GPrivate g_thread_specific_private = G_PRIVATE_INIT (g_thread_cleanup
|
||||
*
|
||||
* Sets the thread local variable @key to have a newly-allocated and zero-filled
|
||||
* value of given @size, and returns a pointer to that memory. Allocations made
|
||||
* using this API will be suppressed in valgrind: it is intended to be used for
|
||||
* one-time allocations which are known to be leaked, such as those for
|
||||
* per-thread initialisation data. Otherwise, this function behaves the same as
|
||||
* g_private_set().
|
||||
* using this API will be suppressed in valgrind and leak sanitizer: it is
|
||||
* intended to be used for one-time allocations which are known to be leaked,
|
||||
* such as those for per-thread initialisation data. Otherwise, this function
|
||||
* behaves the same as g_private_set().
|
||||
*
|
||||
* Returns: (transfer full): new thread-local heap allocation of size @size
|
||||
* Since: 2.60
|
||||
@ -520,6 +521,7 @@ g_private_set_alloc0 (GPrivate *key,
|
||||
{
|
||||
gpointer allocated = g_malloc0 (size);
|
||||
|
||||
g_ignore_leak (allocated);
|
||||
g_private_set (key, allocated);
|
||||
|
||||
return g_steal_pointer (&allocated);
|
||||
|
Loading…
x
Reference in New Issue
Block a user