mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-24 19:22:11 +01:00
Merge branch '2753-vasprintf-loop' into 'main'
gprintf: Avoid an infinite loop on ENOMEM in g_vasprintf() Closes #2753 See merge request GNOME/glib!2944
This commit is contained in:
commit
4dcb7f1f9f
@ -342,7 +342,14 @@ g_vasprintf (gchar **string,
|
||||
if (len < 0)
|
||||
{
|
||||
if (saved_errno == ENOMEM)
|
||||
g_error ("%s: failed to allocate memory", G_STRLOC);
|
||||
{
|
||||
/* Try and print a message to be a bit helpful, but stick to the
|
||||
* bare minimum to avoid any code path which could try and fail to
|
||||
* allocate additional memory. */
|
||||
fputs (G_STRLOC, stderr);
|
||||
fputs (": failed to allocate memory\n", stderr);
|
||||
g_abort ();
|
||||
}
|
||||
else
|
||||
*string = NULL;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user