From a60e705e51b4fe3d3c5462b53b41359d556ea32c Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Fri, 3 May 2019 16:36:08 +0200 Subject: [PATCH] mthread: make malloc failure fatal --- mthread.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mthread.c b/mthread.c index 3dbccbb..70b36b3 100644 --- a/mthread.c +++ b/mthread.c @@ -74,10 +74,14 @@ struct container * midcont(char *mid) { struct container key, **result; + if (!mid) + exit(111); key.mid = mid; if (!(result = tfind(&key, &mids, midorder))) { struct container *c = malloc(sizeof (struct container)); + if (!c) + exit(111); c->mid = mid; c->file = 0; c->msg = 0; @@ -281,6 +285,8 @@ void find_roots() { top = malloc(sizeof (struct container)); + if (!top) + exit(111); top->msg = 0; top->date = -1; top->file = 0;