serial: fix memory leak in case of error out.

This commit is contained in:
Zhang Zhaolong 2014-04-26 12:24:56 +08:00
parent 5cb7819830
commit 7b1e773929

View File

@ -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.