Free z80 buffer after assembly

This commit is contained in:
Lazula 2022-02-28 12:20:57 -06:00 committed by pancake
parent 81573f6b1d
commit b11522fd94

View File

@ -785,9 +785,9 @@ static int assemble(const char *str, unsigned char *_obuf) {
obuflen = 0;
obuf = _obuf;
int cmd, cont = 1;
// XXX: must free
z80buffer = strdup (str);
if (!cont) {
free (z80buffer);
return obuflen;
}
// if (havelist)
@ -804,6 +804,7 @@ static int assemble(const char *str, unsigned char *_obuf) {
++stack[sp].line;
ptr = delspc (ptr);
if (!*ptr) {
free (z80buffer);
return obuflen;
}
if (!define_macro) {
@ -813,6 +814,7 @@ static int assemble(const char *str, unsigned char *_obuf) {
}
ptr = delspc (ptr);
if (!*ptr) {
free (z80buffer);
return obuflen;
}
comma = 0;
@ -1512,9 +1514,11 @@ static int assemble(const char *str, unsigned char *_obuf) {
break;
default:
// eprintf ("command or comment expected (was %s)\n", ptr);
free (z80buffer);
return 0;
}
free (z80buffer);
return obuflen;
}