summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2017-11-21 14:46:06 +0000
committerSimon McVittie <smcv@collabora.com>2017-11-24 12:17:33 +0000
commita9aef9b378b05f5a7f0ce55b89684990d5447df8 (patch)
treefc7932616b8d8bdf915f1b8c5aee4c557a25df41
parent9ded6907e66b89c3c74620a4485e8f752f092a60 (diff)
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
-rw-r--r--dbus/dbus-nonce.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/dbus/dbus-nonce.c b/dbus/dbus-nonce.c
index 146099f4a..b56116b32 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() */