aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Orzechowski <alex@ozal.ski>2024-06-04 20:05:58 -0400
committerSimon Ser <contact@emersion.fr>2024-09-20 19:48:52 +0200
commit5a920c48d1b2236c0b6c376611dc5d17a080bb8b (patch)
treee01a23aea181bc1d4327eae193cffc2e7d69bc74
parentb4d550bff88b046a82420b6e223276e9e65e8005 (diff)
text_input: Check for allocation failure
(cherry picked from commit 48069097ea55021afa0af3c5148cb7caab724dcf)
-rw-r--r--sway/input/text_input.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/sway/input/text_input.c b/sway/input/text_input.c
index 580a9f54..4d52fedc 100644
--- a/sway/input/text_input.c
+++ b/sway/input/text_input.c
@@ -448,6 +448,11 @@ static void handle_im_new_popup_surface(struct wl_listener *listener,
struct sway_input_method_relay *relay = wl_container_of(listener, relay,
input_method_new_popup_surface);
struct sway_input_popup *popup = calloc(1, sizeof(*popup));
+ if (!popup) {
+ sway_log(SWAY_ERROR, "Failed to allocate an input method popup");
+ return;
+ }
+
popup->relay = relay;
popup->popup_surface = data;
popup->popup_surface->data = popup;