gprintf: Fix a memory leak with an invalid format in g_vasprintf()

If using the fallback implementation of `g_vasprintf()`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Coverity CID: #1474726
This commit is contained in:
Philip Withnall 2022-03-09 14:07:34 +00:00
parent b3a568d19e
commit 7329c6e09b

View File

@ -356,6 +356,12 @@ g_vasprintf (gchar **string,
len = _g_vsprintf (*string, format, args2);
va_end (args2);
if (len < 0)
{
g_free (*string);
*string = NULL;
}
}
#endif