dbus-nonce: Don't crash on encountering OOM

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89104
This commit is contained in:
Simon McVittie 2017-11-21 14:46:06 +00:00
parent 9ded6907e6
commit a9aef9b378

View file

@ -301,6 +301,11 @@ do_noncefile_create (DBusNonceFile **noncefile_out,
_dbus_assert (*noncefile_out == NULL);
noncefile = dbus_new0 (DBusNonceFile, 1);
if (noncefile == NULL)
{
dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
return FALSE;
}
/* Make it valid to "free" these even if _dbus_string_init() runs
* out of memory: see comment in do_check_nonce() */