From: Martin Ling Date: Wed, 18 Mar 2015 18:02:06 +0000 (+0000) Subject: scpi-pps: Initialise sdi with status SR_ST_INACTIVE. X-Git-Tag: libsigrok-0.4.0~592 X-Git-Url: https://sigrok.org/gitweb/?p=libsigrok.git;a=commitdiff_plain;h=7d4f1741e377099b9151226eb950ccbf89281fb0 scpi-pps: Initialise sdi with status SR_ST_INACTIVE. Without this change a segfault occurs at exit after scan, because dev_close() is called and the device is believed to be open. --- diff --git a/src/hardware/scpi-pps/api.c b/src/hardware/scpi-pps/api.c index 4647031c..0539e81a 100644 --- a/src/hardware/scpi-pps/api.c +++ b/src/hardware/scpi-pps/api.c @@ -90,7 +90,7 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi) } sdi = g_malloc0(sizeof(struct sr_dev_inst)); - sdi->status = SR_ST_ACTIVE; + sdi->status = SR_ST_INACTIVE; sdi->vendor = g_strdup(vendor); sdi->model = g_strdup(hw_info->model); sdi->version = g_strdup(hw_info->firmware_version); @@ -193,7 +193,7 @@ static int dev_open(struct sr_dev_inst *sdi) struct sr_scpi_dev_inst *scpi; GVariant *beeper; - if (sdi->status != SR_ST_ACTIVE) + if (sdi->status != SR_ST_INACTIVE) return SR_ERR; scpi = sdi->conn;