From: Simon McVittie Date: Wed, 19 Jan 2011 17:33:31 +0000 (+0000) Subject: test_server_setup: allocate two server-data blobs, for watches and timeouts X-Git-Tag: dbus-1.4.4~13^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e529c4bcdbe51502662666c6cf8acae3e2446873;p=thirdparty%2Fdbus.git test_server_setup: allocate two server-data blobs, for watches and timeouts This is similar to how ConnectionData works. Without this change, we deserve to segfault: when the first set of callbacks (either watches or timeouts) is cleaned up, we unref the server and loop, and free sd; when the second set of callbacks is cleaned up, we use-after-free sd, the server and the loop, then double-free sd. However, due to fd.o #33277 we don't even get that far, because we've already died with an assertion failure. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33277 --- diff --git a/test/test-utils.c b/test/test-utils.c index 67e207c56..1c78812a0 100644 --- a/test/test-utils.c +++ b/test/test-utils.c @@ -307,6 +307,10 @@ test_server_setup (DBusLoop *loop, goto nomem; } + sd = serverdata_new (loop, server); + if (sd == NULL) + goto nomem; + if (!dbus_server_set_timeout_functions (server, add_server_timeout, remove_server_timeout,