From 995fe92e48bb007f4763272f7dd600a335bd2f35 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 21 Nov 2017 14:46:06 +0000 Subject: [PATCH 09/12] dbus-nonce: Don't crash on encountering OOM Signed-off-by: Simon McVittie --- dbus/dbus-nonce.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dbus/dbus-nonce.c b/dbus/dbus-nonce.c index 146099f4..b56116b3 100644 --- a/dbus/dbus-nonce.c +++ b/dbus/dbus-nonce.c @@ -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() */ -- 2.15.0