From a1281abf02bfac293988a66765d67b7f12ec0e1c Mon Sep 17 00:00:00 2001 From: crc Date: Tue, 28 May 2019 20:26:28 +0000 Subject: [PATCH] fix some dead code issues found by tankf33der FossilOrigin-Name: 3f6ad39437ef09616919e7a642ac235fe0042ade241220a007d6d92b8afe61ac --- literate/Muri.md | 4 ++++ tools/extend.c | 2 +- tools/muri.c | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/literate/Muri.md b/literate/Muri.md index fe24272..d1049ed 100644 --- a/literate/Muri.md +++ b/literate/Muri.md @@ -258,6 +258,10 @@ void pass2(char *fname) { buffer = (char *)source; here = 0; fp = fopen(fname, "r"); + if (fp == NULL) { + printf("Unable to load file\n"); + exit(2); + } while (!feof(fp)) { read_line(fp, buffer); if (strcmp(buffer, "~~~") == 0) { diff --git a/tools/extend.c b/tools/extend.c index d8194ae..82118e3 100644 --- a/tools/extend.c +++ b/tools/extend.c @@ -332,7 +332,7 @@ void read_token(FILE *file, char *token_buffer, int echo, int max) { CELL ngaLoadImage(char *imageFile) { FILE *fp; - CELL imageSize; + CELL imageSize = 0; long fileLen; if ((fp = fopen(imageFile, "rb")) != NULL) { /* Determine length (in cells) */ diff --git a/tools/muri.c b/tools/muri.c index 4a7899a..e9a891c 100644 --- a/tools/muri.c +++ b/tools/muri.c @@ -133,6 +133,10 @@ void pass2(char *fname) { buffer = (char *)source; here = 0; fp = fopen(fname, "r"); + if (fp == NULL) { + printf("Unable to load file\n"); + exit(2); + } while (!feof(fp)) { read_line(fp, buffer); if (strcmp(buffer, "~~~") == 0) {