Actually free malloc'ed memory

This commit is contained in:
maride 2023-10-08 00:25:37 +02:00
parent becf5cc65d
commit 89ef1759ab

View File

@ -10,7 +10,7 @@
** _building_ LuaJIT. There's no point in distributing or installing it.
** Only the object code generated by this tool is linked into LuaJIT.
**
** Caveat: some memory is not free'd, error handling is lazy.
** Caveat: error handling is lazy.
** It's a one-shot tool -- any effort fixing this would be wasted.
*/
@ -524,6 +524,20 @@ int main(int argc, char **argv)
}
fclose(ctx->fp);
// cleanup
free(ctx->code);
free(ctx->glob);
for(int i=0; i<=ctx->nsym; i++) {
free((void*)ctx->sym[i].name);
}
free(ctx->sym);
for(int i=0; i<ctx->nrelocsym; i++) {
free((void*)ctx->relocsym[i]);
}
free(ctx->relocsym);
free(ctx->bc_ofs);
free((void*)ctx->beginsym);
return 0;
}