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>
This commit is contained in:
Zach Reizner 2019-06-18 16:00:33 -07:00 committed by Commit Bot
parent 4aaefc377f
commit f51787b1c7

View file

@ -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;
}