From 21b9cc33337e904dee4cac87794291ca95a148dd Mon Sep 17 00:00:00 2001 From: Michael R Torres Date: Thu, 20 Feb 2020 20:29:00 -0800 Subject: mz: Zero memory allocated for new automops element Prevent crashes when using mausezahn in interactive mode by using calloc to zero the memory upon allocation. Fixes #195 Signed-off-by: Michael R Torres Signed-off-by: Tobias Klauser --- staging/automops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/staging/automops.c b/staging/automops.c index 05fb7de..b67ec90 100644 --- a/staging/automops.c +++ b/staging/automops.c @@ -26,7 +26,7 @@ struct automops * automops_init(void) { // Create initial automops element: - struct automops *new_automops = (struct automops*) malloc(sizeof(struct automops)); + struct automops *new_automops = (struct automops*) calloc(1, sizeof(struct automops)); new_automops->next = new_automops; new_automops->prev = new_automops; automops_set_defaults (new_automops); -- cgit v1.2.3-54-g00ecf