diff options
author | Simon McVittie <smcv@collabora.com> | 2017-11-27 19:23:10 +0000 |
---|---|---|
committer | Simon McVittie <smcv@collabora.com> | 2017-12-04 11:52:45 +0000 |
commit | 38ff6bd20d58b57a5dd0eab1b1c09c5c43b61d26 (patch) | |
tree | 7420e683aa7f454f2da0f3a8952bc44b9fe71509 | |
parent | 929c15c797d1cb1fae373b275c66cb9a6082454f (diff) |
test_connection_setup: Don't crash on unlikely OOM
If _dbus_loop_queue_dispatch fails with OOM, we'd try to free cd,
while cd is already owned by the connection's timeout functions.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=100317
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Signed-off-by: Simon McVittie <smcv@collabora.com>
-rw-r--r-- | test/test-utils.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/test/test-utils.c b/test/test-utils.c index 843fda1a..53ad4a4e 100644 --- a/test/test-utils.c +++ b/test/test-utils.c @@ -108,7 +108,8 @@ test_connection_setup (TestMainContext *ctx, dbus_connection_set_dispatch_status_function (connection, dispatch_status_function, loop, NULL); - + /* ownership of cd taken */ + cd = cdata_new (loop, connection); if (cd == NULL) goto nomem; @@ -132,6 +133,9 @@ test_connection_setup (TestMainContext *ctx, cd, cdata_free)) goto nomem; + /* ownership taken */ + cd = NULL; + if (dbus_connection_get_dispatch_status (connection) != DBUS_DISPATCH_COMPLETE) { if (!_dbus_loop_queue_dispatch (loop, connection)) |