]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
_dbus_server_new_for_tcp_socket: Don't pile up errors on OOM
authorSimon McVittie <smcv@collabora.com>
Tue, 21 Nov 2017 14:39:58 +0000 (14:39 +0000)
committerSimon McVittie <smcv@collabora.com>
Fri, 24 Nov 2017 12:17:30 +0000 (12:17 +0000)
If _dbus_noncefile_create() has failed and set error, it is incorrect
for us to set it again.

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-server-socket.c

index 460b535cad446bdba90db5bad570dde2e6d0161d..7d9aea1a92967677d9c360cd43033b45ac67f86c 100644 (file)
@@ -482,8 +482,10 @@ _dbus_server_new_for_tcp_socket (const char     *host,
 
   if (use_nonce)
     {
-      if (!_dbus_noncefile_create (&noncefile, error) ||
-          !_dbus_string_append (&address, ",noncefile=") ||
+      if (!_dbus_noncefile_create (&noncefile, error))
+        goto failed_2;
+
+      if (!_dbus_string_append (&address, ",noncefile=") ||
           !_dbus_address_append_escaped (&address, _dbus_noncefile_get_path (noncefile)))
         {
           dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);