diff options
author | Juan J. Martinez <jjm@usebox.net> | 2023-06-05 08:01:18 +0100 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2023-06-05 08:01:53 +0100 |
commit | 0699a11f0ffcd7c536bdb5ab45d898e3c6eb4a3c (patch) | |
tree | 5f5866887cfd2517c3ced69392f4332b042d6f9e | |
parent | 030704970dcfc29c7c82e2aefb4f2646634cc24c (diff) | |
download | tr8vm-0699a11f0ffcd7c536bdb5ab45d898e3c6eb4a3c.tar.gz tr8vm-0699a11f0ffcd7c536bdb5ab45d898e3c6eb4a3c.zip |
n case mstrdup failed, avoid free on NULL
-rw-r--r-- | tr8as.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -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; } |