Kernel version 0.8 : Fixed a nasty memory leak in CreateProcessYA area

This commit is contained in:
Rémy GIBERT 2016-11-01 18:18:04 +01:00
parent 6e45564298
commit af54e1e393
6 changed files with 31 additions and 37 deletions

Binary file not shown.

Binary file not shown.

View File

@ -68,10 +68,11 @@ CS.INIT >SYSCALL GetArgC
>SYSCALL GetArgA
bcs .99
>SYSCALL NewPStrYA
>SYSCALL ExpandPStrYA
bcs .99
txa
ldy #hBinName
sta (pData),y
clc

View File

@ -50,10 +50,6 @@ CS.RUN lda #0
ldy #hPASSWORD
sta (pData),y
lda #13
>SYSCALL COutA
bcs .9
>LDYA L.MSG.LOGIN
>SYSCALL PrintFYA
bcs .9
@ -65,12 +61,10 @@ CS.RUN lda #0
jsr INPUT.LINEIN
bcc .1
lda #13
>SYSCALL COutA
bcs .9
>LDYA L.MSG.PASSWORD
>SYSCALL PrintFYA
bcs .9
lda #'*'
jsr INPUT.RESET
@ -83,14 +77,22 @@ CS.RUN lda #0
bcs .9
>LDYA L.SHELL
>SYSCALL ExpandPStrYA
bcs .9
stx .3+1
>SYSCALL ExecProcessNewEnvYA
bcs .9
php
pha
.3 lda #$ff Self Modified
>SYSCALL FreeMemA
pla
plp
rts
.8 clc
rts
.9 sec
rts
.9 rts
*--------------------------------------
CS.DOEVENT ldy #S.EVT.hDEV
lda (pEvent),y
@ -196,8 +198,8 @@ INPUT.LINEIN ldy #INPUT.Status
rts
*--------------------------------------
CS.END
MSG.LOGIN >CSTR "login:"
MSG.PASSWORD >CSTR "password:"
MSG.LOGIN >CSTR "\nlogin:"
MSG.PASSWORD >CSTR "\npassword:"
SHELL >PSTR "${A2OSX}SBIN/SHELL"
.DUMMY
.OR 0

View File

@ -61,8 +61,12 @@ Kernel.Init3 jsr K.DevMgrInit
>SYSCALL PrintFYA
>LDYAI STARTUP.CMDLINE
>SYSCALL ExpandPStrYA
phx Save Expanded CMDLINE for discard
>SYSCALL CreateProcessYA
bcs .9
pla
>SYSCALL FreeMemA ...discard...
>LDYAI MSG.Init3.OK
>SYSCALL PrintFYA
@ -78,7 +82,7 @@ Kernel.Init3 jsr K.DevMgrInit
.9 >PUSHA
>LDYAI MSG.StartupErr
>SYSCALL PrintFYA
bra *
bra * No need to discard Expanded CMDLINE
*--------------------------------------
* K.DevMgrInit
*--------------------------------------

View File

@ -25,40 +25,27 @@ K.CreateProcessNewEnvYA
K.CreateProcessYA
ldx #0
stx K.CreateProcess.Flags
jsr K.ExpandPStrYA
bcs .99
stx K.CreateProcess.hCmdLine
>STYA K.CreateProcess.CmdLine
jsr PS.CreateChild
bcs .98
bcs .9
sta K.CreateProcess.CPSID
jsr PS.Init
bcs .97
bcc .8
lda K.CreateProcess.CPSID
clc
rts
.97 pha save error code
pha save error code
lda K.CreateProcess.CPSID
jsr PS.FreeA
pla get back error code
.98 pha
lda K.CreateProcess.hCmdLine
jsr K.FreeMemA
pla
.99 sec
sec
rts
.8 lda K.CreateProcess.CPSID
.9 rts
*--------------------------------------
K.CreateProcess.Flags .BS 1
K.CreateProcess.hCmdLine .BS 1
K.CreateProcess.CmdLine .BS 2
K.CreateProcess.CPSID .BS 1
*/--------------------------------------