Some unusual modes required re-parsing the value. Instead of assigning the
re-parsed value to *floatval, it was reassigned directly to *analog->data;
however, analog->data is not initialized at this point, causing a segfault.
This situation was created when moving the radioshack-dmm code to serial-dmm,
with the segfault not being observed at that time.
Do not write directly to analog->data, but instead use the intermediate
variable rawval.
Signed-off-by: Alexandru Gagniuc <redacted>
case MODE_CONT:
analog->mq = SR_MQ_CONTINUITY;
analog->unit = SR_UNIT_BOOLEAN;
case MODE_CONT:
analog->mq = SR_MQ_CONTINUITY;
analog->unit = SR_UNIT_BOOLEAN;
- *analog->data = is_shortcirc(rs_packet);
+ rawval = is_shortcirc(rs_packet);
break;
case MODE_DIODE:
analog->mq = SR_MQ_VOLTAGE;
break;
case MODE_DIODE:
analog->mq = SR_MQ_VOLTAGE;
} else {
/* We have either HI or LOW. */
analog->unit = SR_UNIT_BOOLEAN;
} else {
/* We have either HI or LOW. */
analog->unit = SR_UNIT_BOOLEAN;
- *analog->data = is_logic_high(rs_packet);
+ rawval = is_logic_high(rs_packet);
case MODE_TEMP:
analog->mq = SR_MQ_TEMPERATURE;
/* We need to reparse. */
case MODE_TEMP:
analog->mq = SR_MQ_TEMPERATURE;
/* We need to reparse. */
- *analog->data = lcd_to_double(rs_packet, READ_TEMP);
+ rawval = lcd_to_double(rs_packet, READ_TEMP);
analog->unit = is_celsius(rs_packet) ?
SR_UNIT_CELSIUS : SR_UNIT_FAHRENHEIT;
break;
analog->unit = is_celsius(rs_packet) ?
SR_UNIT_CELSIUS : SR_UNIT_FAHRENHEIT;
break;