ansilove

ANSI and ASCII art to PNG converter in C
Log | Files | Refs | README | LICENSE

commit d8a22709fb90dc99fc8cd4f29ce010035fd10d1f
parent bf792a0d96d2a9586255c390389925d5069e4753
Author: Frederic Cambus <fred@statdns.com>
Date:   Mon, 19 Oct 2020 14:38:21 +0200

Only call memset() if the malloc call succeeds.

Passing a null pointer to memset() is undefined behavior.

Diffstat:
Msrc/sauce.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/sauce.c b/src/sauce.c @@ -36,9 +36,9 @@ sauceReadFile(FILE *file) { struct sauce *record; record = malloc(sizeof *record); - memset(record, 0, sizeof *record); if (record != NULL) { + memset(record, 0, sizeof *record); readRecord(file, record); } return record;