mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-04-01 21:33:09 +02:00
Do not check for NULL when calling free()
The C standard guarantees that `free()` is `NULL`-safe.
This commit is contained in:
parent
8aff74e213
commit
84d013ed46
@ -170,8 +170,7 @@ g_realloc (gpointer mem,
|
|||||||
G_STRLOC, n_bytes);
|
G_STRLOC, n_bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mem)
|
free (mem);
|
||||||
free (mem);
|
|
||||||
|
|
||||||
TRACE (GLIB_MEM_REALLOC((void*) NULL, (void*)mem, 0, 0));
|
TRACE (GLIB_MEM_REALLOC((void*) NULL, (void*)mem, 0, 0));
|
||||||
|
|
||||||
@ -190,8 +189,7 @@ g_realloc (gpointer mem,
|
|||||||
void
|
void
|
||||||
g_free (gpointer mem)
|
g_free (gpointer mem)
|
||||||
{
|
{
|
||||||
if (G_LIKELY (mem))
|
free (mem);
|
||||||
free (mem);
|
|
||||||
TRACE(GLIB_MEM_FREE((void*) mem));
|
TRACE(GLIB_MEM_FREE((void*) mem));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -304,8 +302,7 @@ g_try_realloc (gpointer mem,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
newmem = NULL;
|
newmem = NULL;
|
||||||
if (mem)
|
free (mem);
|
||||||
free (mem);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE (GLIB_MEM_REALLOC((void*) newmem, (void*)mem, (unsigned int) n_bytes, 1));
|
TRACE (GLIB_MEM_REALLOC((void*) newmem, (void*)mem, (unsigned int) n_bytes, 1));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user