readline: fix stack memory leak on Linux

pull/5102/head
Matt Baulch 2020-05-28 23:38:20 +10:00 committed by GitHub
parent 9609b3a9c8
commit da9b3d82d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -48,13 +48,13 @@ pub fn (mut r Readline) enable_raw_mode() {
r.is_raw = false r.is_raw = false
return return
} }
mut raw := r.orig_termios mut raw := &r.orig_termios
raw.c_iflag &= ~( C.BRKINT | C.ICRNL | C.INPCK | C.ISTRIP | C.IXON ) raw.c_iflag &= ~( C.BRKINT | C.ICRNL | C.INPCK | C.ISTRIP | C.IXON )
raw.c_cflag |= ( C.CS8 ) raw.c_cflag |= ( C.CS8 )
raw.c_lflag &= ~( C.ECHO | C.ICANON | C.IEXTEN | C.ISIG ) raw.c_lflag &= ~( C.ECHO | C.ICANON | C.IEXTEN | C.ISIG )
raw.c_cc[C.VMIN] = 1 raw.c_cc[C.VMIN] = 1
raw.c_cc[C.VTIME] = 0 raw.c_cc[C.VTIME] = 0
C.tcsetattr(0, C.TCSADRAIN, &raw) C.tcsetattr(0, C.TCSADRAIN, raw)
r.is_raw = true r.is_raw = true
r.is_tty = true r.is_tty = true
} }