From b3d817dd06a1e54c16e1c6cfa864f6199edb7319 Mon Sep 17 00:00:00 2001
From: "Sven M. Hallberg" <pesco@khjk.org>
Date: Mon, 19 Dec 2022 23:10:11 +0000
Subject: [PATCH] trigger an assert if malloc fails

Also removes an unneeded memset.
---
 lzw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lzw.c b/lzw.c
index 995a985..dc5deca 100644
--- a/lzw.c
+++ b/lzw.c
@@ -290,7 +290,7 @@ act_lzwdata(const HParseResult *p, void *u)
 void init_LZW_parser()
 {
 	context = malloc(sizeof(LZW_context_T));
-	memset(context, 0, sizeof(*context));
+	assert(context != NULL);
 	context->next = 258;
 	/* set up literals in LZW code table */
 	for(int i = 0; i < 256; i++)
-- 
GitLab