dbus_server_listen: Don't leak first_connect_error
authorSimon McVittie <smcv@collabora.com>
Wed, 11 Jul 2018 15:16:38 +0000 (16:16 +0100)
committerSimon McVittie <smcv@collabora.com>
Thu, 2 Aug 2018 16:13:02 +0000 (17:13 +0100)
If an implementation fails to listen, and a subsequent implementation
succeeds, then we would have leaked this. Detected by running
tests/loopback.c under valgrind.

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

dbus/dbus-server.c

index d91df83..7a1243b 100644 (file)
@@ -680,6 +680,7 @@ dbus_server_listen (const char     *address,
     }
   else
     {
+      dbus_error_free (&first_connect_error);
       _DBUS_ASSERT_ERROR_IS_CLEAR (error);
       return server;
     }