diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-11-30 15:25:37 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-12-03 16:45:41 +0100 |
commit | b39ae775d6c13474d0c3b74acfd642a420f1faba (patch) | |
tree | 8d5cc54b33a3347524d2bb26011dea93c3c0011e | |
parent | 1e23fe62fe80a7351760bfb7fe9eeba7631d882b (diff) |
serial: clear serial info struct before calling ioctl()
We need the kernel driver to give a proper value for the 'closing_wait'
variable, but don't assume it will.
This should solve the following kind of issues reported by valgrind:
==8985== Conditional jump or move depends on uninitialised value(s)
==8985== at 0x4409A6: mm_serial_port_close (mm-serial-port.c:932)
==8985== by 0x41A420: disable_all_done (mm-generic-cdma.c:753)
==8985== by 0x4125A4: mm_manager_shutdown (mm-manager.c:1130)
==8985== by 0x40DE35: main (main.c:203)
-rw-r--r-- | src/mm-serial-port.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mm-serial-port.c b/src/mm-serial-port.c index 0a8820d2..04cac88c 100644 --- a/src/mm-serial-port.c +++ b/src/mm-serial-port.c | |||
@@ -840,7 +840,7 @@ mm_serial_port_open (MMSerialPort *self, GError **error) | |||
840 | MMSerialPortPrivate *priv; | 840 | MMSerialPortPrivate *priv; |
841 | char *devfile; | 841 | char *devfile; |
842 | const char *device; | 842 | const char *device; |
843 | struct serial_struct sinfo; | 843 | struct serial_struct sinfo = { 0 }; |
844 | GTimeVal tv_start, tv_end; | 844 | GTimeVal tv_start, tv_end; |
845 | 845 | ||
846 | g_return_val_if_fail (MM_IS_SERIAL_PORT (self), FALSE); | 846 | g_return_val_if_fail (MM_IS_SERIAL_PORT (self), FALSE); |
@@ -977,7 +977,7 @@ mm_serial_port_close (MMSerialPort *self) | |||
977 | 977 | ||
978 | if (priv->fd >= 0) { | 978 | if (priv->fd >= 0) { |
979 | GTimeVal tv_start, tv_end; | 979 | GTimeVal tv_start, tv_end; |
980 | struct serial_struct sinfo; | 980 | struct serial_struct sinfo = { 0 }; |
981 | 981 | ||
982 | mm_info ("(%s) closing serial port...", device); | 982 | mm_info ("(%s) closing serial port...", device); |
983 | 983 | ||