summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2012-11-30 14:25:37 (GMT)
committerAleksander Morgado <aleksander@lanedo.com>2012-12-03 15:45:41 (GMT)
commitb39ae775d6c13474d0c3b74acfd642a420f1faba (patch)
tree8d5cc54b33a3347524d2bb26011dea93c3c0011e
parent1e23fe62fe80a7351760bfb7fe9eeba7631d882b (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.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mm-serial-port.c b/src/mm-serial-port.c
index 0a8820d..04cac88 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)
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);
@@ -977,7 +977,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);