From: Matthew Fernandez Date: Fri, 2 Sep 2022 01:12:22 +0000 (-0700) Subject: smyrna load_mouse_actions: fix unchecked allocation failure X-Git-Tag: 6.0.1~13^2~19 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=63b95ef19231bb61ae64e313f58e3f80bd8eb4cd;p=graphviz smyrna load_mouse_actions: fix unchecked allocation failure --- 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;