serial: fix memory leak in case of error out.
This commit is contained in:
parent
5cb7819830
commit
7b1e773929
@ -426,8 +426,10 @@ BOOL serial_tty_read(SERIAL_TTY* tty, BYTE* buffer, UINT32* Length)
|
||||
|
||||
ptermios = (struct termios*) calloc(1, sizeof(struct termios));
|
||||
|
||||
if (tcgetattr(tty->fd, ptermios) < 0)
|
||||
if (tcgetattr(tty->fd, ptermios) < 0) {
|
||||
free(ptermios);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* If a timeout is set, do a blocking read, which times out after some time.
|
||||
|
Loading…
Reference in New Issue
Block a user