summary refs log tree commit diff
path: root/gpu_display
diff options
context:
space:
mode:
authorZach Reizner <zachr@google.com>2019-06-18 16:00:33 -0700
committerCommit Bot <commit-bot@chromium.org>2019-06-24 23:59:06 +0000
commitf51787b1c75390ce699719e2b39fea6459d06e76 (patch)
tree35d94d3afa1a465e71d1fbf0df0c5bbfa1c9c34c /gpu_display
parent4aaefc377f37a14ecad2725946d8385b92ceb1e4 (diff)
downloadcrosvm-f51787b1c75390ce699719e2b39fea6459d06e76.tar
crosvm-f51787b1c75390ce699719e2b39fea6459d06e76.tar.gz
crosvm-f51787b1c75390ce699719e2b39fea6459d06e76.tar.bz2
crosvm-f51787b1c75390ce699719e2b39fea6459d06e76.tar.lz
crosvm-f51787b1c75390ce699719e2b39fea6459d06e76.tar.xz
crosvm-f51787b1c75390ce699719e2b39fea6459d06e76.tar.zst
crosvm-f51787b1c75390ce699719e2b39fea6459d06e76.zip
gpu_display: fix dangling NULL pointer in dwl_context_setup
If the dwl_context_setup routine fails after creating a wayland
connection succesfully (e.g. if an extension is missing), the fail label
is jumped to in order to disconnect the wayland connection and
deallocate the wl_display structure. That label did not set
self->display to NULL after calling wl_display_disconnect, which would
cause the dwl_context_destroy routine to call wl_display_disconnect again,
which is a double free. This CL fixes that ommission.

TEST=None
BUG=None

Change-Id: I5b6c2d6fadda82dff4130bd4abb0e7764c15e004
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1668528
Tested-by: Zach Reizner <zachr@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Commit-Queue: Zach Reizner <zachr@chromium.org>
Diffstat (limited to 'gpu_display')
-rw-r--r--gpu_display/src/display_wl.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/gpu_display/src/display_wl.c b/gpu_display/src/display_wl.c
index fce0ee0..00869a4 100644
--- a/gpu_display/src/display_wl.c
+++ b/gpu_display/src/display_wl.c
@@ -425,6 +425,7 @@ bool dwl_context_setup(struct dwl_context *self, const char *socket_path)
 
 fail:
 	wl_display_disconnect(display);
+	self->display = NULL;
 	return false;
 }