From 0699a11f0ffcd7c536bdb5ab45d898e3c6eb4a3c Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Mon, 5 Jun 2023 08:01:18 +0100 Subject: n case mstrdup failed, avoid free on NULL --- tr8as.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'tr8as.c') diff --git a/tr8as.c b/tr8as.c index e150aeb..36418fa 100644 --- a/tr8as.c +++ b/tr8as.c @@ -1667,11 +1667,14 @@ static uint8_t asm(As *as, const char *filename, FILE *in) rc = resolve(as); for (i = 0; i < as->rcnt; i++) - free((void *)as->refs[i].loc.filename); + if (as->refs[i].loc.filename) + free((void *)as->refs[i].loc.filename); for (i = 0; i < as->dcnt; i++) - free((void *)as->defs[i].loc.filename); + if (as->defs[i].loc.filename) + free((void *)as->defs[i].loc.filename); for (i = 0; i < as->lcnt; i++) - free((void *)as->labels[i].loc.filename); + if (as->labels[i].loc.filename) + free((void *)as->labels[i].loc.filename); return rc; } -- cgit v1.2.3