From dd57418494196f83f164ea075e87ba9ad5d0ebb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Tue, 5 Nov 2019 08:51:10 +0100 Subject: [PATCH] selection: initialize 'ctx' before jumping into its scope --- selection.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/selection.c b/selection.c index bd9d76fb..9dddf365 100644 --- a/selection.c +++ b/selection.c @@ -328,11 +328,11 @@ struct clipboard_send { static bool fdm_send(struct fdm *fdm, int fd, int events, void *data) { + struct clipboard_send *ctx = data; + if (events & EPOLLHUP) goto done; - struct clipboard_send *ctx = data; - switch (async_write(fd, ctx->data, ctx->len, &ctx->idx)) { case ASYNC_WRITE_REMAIN: return true;