diff options
author | Jonathan Liu <net147@gmail.com> | 2015-03-09 22:35:56 +1100 |
---|---|---|
committer | Jonathan Liu <net147@gmail.com> | 2015-03-09 11:43:04 +0000 |
commit | 53afe73154c7c00b54cd280fa3d6c9127a2bc84b (patch) | |
tree | a275192564831288e63acc15f17c035b4fa27bd6 | |
parent | 801198fab9f6e29b1cd56a8820606f616e3d256e (diff) |
Unix: Clear serial_struct instancesv5.5.0-alpha1
Silences the following Valgrind warning:
Conditional jump or move depends on uninitialised value(s)
Change-Id: I8fd8cfd6aa6f75ed515e6151cfc282faca508bdc
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
-rw-r--r-- | src/serialport/qserialport_unix.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/serialport/qserialport_unix.cpp b/src/serialport/qserialport_unix.cpp index 34ef41d2..7cf356bb 100644 --- a/src/serialport/qserialport_unix.cpp +++ b/src/serialport/qserialport_unix.cpp @@ -439,6 +439,8 @@ QSerialPortPrivate::setStandardBaudRate(qint32 baudRate, QSerialPort::Directions { struct serial_struct currentSerialInfo; + ::memset(¤tSerialInfo, 0, sizeof(currentSerialInfo)); + if ((::ioctl(descriptor, TIOCGSERIAL, ¤tSerialInfo) != -1) && (currentSerialInfo.flags & ASYNC_SPD_CUST)) { currentSerialInfo.flags &= ~ASYNC_SPD_CUST; @@ -469,6 +471,8 @@ QSerialPortPrivate::setCustomBaudRate(qint32 baudRate, QSerialPort::Directions d struct serial_struct currentSerialInfo; + ::memset(¤tSerialInfo, 0, sizeof(currentSerialInfo)); + if (::ioctl(descriptor, TIOCGSERIAL, ¤tSerialInfo) == -1) return decodeSystemError(); |