summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael R Torres <mic.ric.tor@gmail.com>2020-02-20 20:29:00 -0800
committerTobias Klauser <tklauser@distanz.ch>2020-02-21 11:51:30 +0100
commit21b9cc33337e904dee4cac87794291ca95a148dd (patch)
tree444535dff98491b3a53b04093e3d7c57029a1090
parent1fe3d20291b339101d8931a15816add1ea85beef (diff)
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 <mic.ric.tor@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
-rw-r--r--staging/automops.c2
1 files changed, 1 insertions, 1 deletions
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);