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)
This commit is contained in:
@@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user