commit 48069097ea55021afa0af3c5148cb7caab724dcf
parent 266cd4515a015b5684eaf6c0b48ce1afa9be2739
Author: Alexander Orzechowski <alex@ozal.ski>
Date: Tue, 4 Jun 2024 20:05:58 -0400
text_input: Check for allocation failure
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git 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;