transport: Don't pile up errors for semicolon-separated components
authorSimon McVittie <smcv@collabora.com>
Mon, 5 Jun 2017 17:16:42 +0000 (18:16 +0100)
committerSimon McVittie <smcv@collabora.com>
Tue, 27 Jun 2017 18:13:40 +0000 (19:13 +0100)
If we somehow get an autolaunch address with multiple
semicolon-separated components, and one of them fails, then we will
hit an assertion failure when we try the next one.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101257
(cherry picked from commit ecdcb86bff42d2bb9cac617bf79f0aa3d47676d9)

dbus/dbus-transport.c

index 31586b1..a56b885 100644 (file)
@@ -254,13 +254,16 @@ check_address (const char *address, DBusError *error)
   int len, i;
 
   _dbus_assert (address != NULL);
+  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
 
   if (!dbus_parse_address (address, &entries, &len, error))
     return NULL;              /* not a valid address */
 
   for (i = 0; i < len; i++)
     {
+      dbus_error_free (error);
       transport = _dbus_transport_open (entries[i], error);
+
       if (transport != NULL)
         break;
     }