]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
dbus-nonce: Don't crash on encountering OOM
authorSimon McVittie <smcv@collabora.com>
Tue, 21 Nov 2017 14:46:06 +0000 (14:46 +0000)
committerSimon McVittie <smcv@collabora.com>
Fri, 24 Nov 2017 12:17:33 +0000 (12:17 +0000)
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

dbus/dbus-nonce.c

index 146099f4a3763dee8c71ba2210a07354dda23608..b56116b320020eec9ca1001d2a7ffd06695b9a79 100644 (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() */