]> sigrok.org Git - libsigrok.git/commitdiff
scpi-pps: Initialise sdi with status SR_ST_INACTIVE.
authorMartin Ling <redacted>
Wed, 18 Mar 2015 18:02:06 +0000 (18:02 +0000)
committerUwe Hermann <redacted>
Fri, 20 Mar 2015 14:33:49 +0000 (15:33 +0100)
Without this change a segfault occurs at exit after scan, because
dev_close() is called and the device is believed to be open.

src/hardware/scpi-pps/api.c

index 4647031c289df9d7a30926e49c91ed9fdbb42915..0539e81aaacfc158d3a9e1cd83f52909349f843f 100644 (file)
@@ -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;