summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2012-11-30 15:25:37 +0100
committerAleksander Morgado <aleksander@lanedo.com>2012-12-03 16:45:27 +0100
commitc1a1d20adaa54de958b070ea3dc3894116009431 (patch)
treefb33d5789a8a914c4402b24d3272445d0f5981af
parent89d6f16e0654cc9dca89330ec1e321295e3471f1 (diff)
downloadModemManager-c1a1d20adaa54de958b070ea3dc3894116009431.tar.gz
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.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mm-serial-port.c b/src/mm-serial-port.c
index f408b95a3..497d14cb7 100644
--- a/src/mm-serial-port.c
+++ b/src/mm-serial-port.c
@@ -788,7 +788,7 @@ mm_serial_port_open (MMSerialPort *self, GError **error)
MMSerialPortPrivate *priv;
char *devfile;
const char *device;
- struct serial_struct sinfo;
+ struct serial_struct sinfo = { 0 };
GTimeVal tv_start, tv_end;
g_return_val_if_fail (MM_IS_SERIAL_PORT (self), FALSE);
@@ -919,7 +919,7 @@ mm_serial_port_close (MMSerialPort *self)
if (priv->fd >= 0) {
GTimeVal tv_start, tv_end;
- struct serial_struct sinfo;
+ struct serial_struct sinfo = { 0 };
mm_info ("(%s) closing serial port...", device);