mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-14 00:06:24 +01:00
gslice: Do not try to memset-0 NULL a pointer
According to the docs, g_slice_free1() is supposed to do nothing if @mem_block is NULL, but we still try to zero it in case we're using g_mem_gc_friendly. So avoid this case. Closes: #2908
This commit is contained in:
parent
95cbff0fd2
commit
6af6f3eb9b
@ -331,7 +331,7 @@ void
|
||||
g_slice_free1 (gsize mem_size,
|
||||
gpointer mem_block)
|
||||
{
|
||||
if (G_UNLIKELY (g_mem_gc_friendly))
|
||||
if (G_UNLIKELY (g_mem_gc_friendly && mem_block))
|
||||
memset (mem_block, 0, mem_size);
|
||||
g_free_sized (mem_block, mem_size);
|
||||
TRACE (GLIB_SLICE_FREE((void*)mem_block, mem_size));
|
||||
|
Loading…
Reference in New Issue
Block a user