1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2025-08-09 01:25:00 +00:00

Free prefix buffer before execmod

This commit is contained in:
David Schmenk
2023-03-18 16:33:55 -07:00
parent af57dfdeeb
commit 4ca1ba9c04
2 changed files with 24 additions and 18 deletions

View File

@@ -170,9 +170,11 @@ end
// //
def shell#1 def shell#1
byte textmode[3] byte textmode[3]
byte prefix[64] word prefix
byte err[] byte err[]
word cmdptr word cmdptr
prefix = heapalloc(64)
// //
// Copy AUTORUN commmand line // Copy AUTORUN commmand line
// //
@@ -188,18 +190,18 @@ def shell#1
break break
is 'P' is 'P'
if ^cmdptr and ^(cmdptr + 1) <> '/' if ^cmdptr and ^(cmdptr + 1) <> '/'
strcat(@prefix, cmdptr) strcat(prefix, cmdptr)
else else
strcpy(@prefix, cmdptr) strcpy(prefix, cmdptr)
fin fin
setpfx(@prefix) setpfx(prefix)
break break
is '/' is '/'
repeat repeat
prefix-- ^prefix--
until prefix[prefix] == '/' until prefix->[^prefix] == '/'
if prefix > 1 if ^prefix > 1
setpfx(@prefix) setpfx(prefix)
fin fin
break break
is 'S' is 'S'
@@ -210,6 +212,7 @@ def shell#1
volumes volumes
break break
is '+' is '+'
heaprelease(prefix)
//cmdsys:modexec(striptrail(cmdptr)) //cmdsys:modexec(striptrail(cmdptr))
return striptrail(cmdptr) return striptrail(cmdptr)
//cmdsys:syswrite(cmdsys.refcons, @textmode, 3) //cmdsys:syswrite(cmdsys.refcons, @textmode, 3)
@@ -226,7 +229,7 @@ def shell#1
fin fin
putln putln
fin fin
puts(getpfx(@prefix)) puts(getpfx(prefix))
cmdptr = gets($BA) cmdptr = gets($BA)
strcpy(cmdsys:cmdline, cmdptr) strcpy(cmdsys:cmdline, cmdptr)
until 0 until 0

View File

@@ -245,9 +245,11 @@ end
// //
def shell#1 def shell#1
byte textmode[3] byte textmode[3]
byte prefix[64] word prefix
byte err[] byte err[]
word cmdptr word cmdptr
prefix = heapalloc(64)
// //
// Copy AUTORUN commmand line // Copy AUTORUN commmand line
// //
@@ -263,18 +265,18 @@ def shell#1
break break
is 'P' is 'P'
if ^cmdptr and ^(cmdptr + 1) <> '/' if ^cmdptr and ^(cmdptr + 1) <> '/'
strcat(@prefix, cmdptr) strcat(prefix, cmdptr)
else else
strcpy(@prefix, cmdptr) strcpy(prefix, cmdptr)
fin fin
setpfx(@prefix) setpfx(prefix)
break break
is '/' is '/'
repeat repeat
prefix-- ^prefix--
until prefix[prefix] == '/' until prefix->[^prefix] == '/'
if prefix > 1 if ^prefix > 1
setpfx(@prefix) setpfx(prefix)
fin fin
break break
is 'S' is 'S'
@@ -285,6 +287,7 @@ def shell#1
volumes volumes
break break
is '+' is '+'
heaprelease(prefix)
*jitcodeptr = jitcbuf *jitcodeptr = jitcbuf
//cmdsys:modexec(striptrail(cmdptr)) //cmdsys:modexec(striptrail(cmdptr))
return striptrail(cmdptr) return striptrail(cmdptr)
@@ -302,7 +305,7 @@ def shell#1
fin fin
putln putln
fin fin
puts(getpfx(@prefix)) puts(getpfx(prefix))
cmdptr = gets($BA) cmdptr = gets($BA)
strcpy(cmdsys:cmdline, cmdptr) strcpy(cmdsys:cmdline, cmdptr)
until 0 until 0