From 63b95ef19231bb61ae64e313f58e3f80bd8eb4cd Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Thu, 1 Sep 2022 18:12:22 -0700 Subject: [PATCH] smyrna load_mouse_actions: fix unchecked allocation failure --- cmd/smyrna/hotkeymap.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/smyrna/hotkeymap.c b/cmd/smyrna/hotkeymap.c index b20e43ea1..c43b9e5a1 100644 --- a/cmd/smyrna/hotkeymap.c +++ b/cmd/smyrna/hotkeymap.c @@ -8,6 +8,7 @@ * Contributors: Details at https://graphviz.org *************************************************************************/ +#include #include "hotkeymap.h" static int get_mouse_mode(const char *s) @@ -129,10 +130,10 @@ void load_mouse_actions(ViewInfo * v) || (strlen(line) == 0)) continue; + v->mouse_actions = gv_recalloc(v->mouse_actions, v->mouse_action_count, + v->mouse_action_count + 1, + sizeof(mouse_action_t)); v->mouse_action_count++; - v->mouse_actions = - realloc(v->mouse_actions, - v->mouse_action_count * sizeof(mouse_action_t)); v->mouse_actions[ind].action = get_mouse_mode(a); v->mouse_actions[ind].index = i; -- 2.50.1