]> sigrok.org Git - libsigrok.git/commitdiff
scpi_vxi: ensure the vxi link was properly opened before closing it
authorAurelien Jacobs <redacted>
Sun, 12 Jan 2014 17:46:24 +0000 (18:46 +0100)
committerAurelien Jacobs <redacted>
Sun, 12 Jan 2014 17:46:24 +0000 (18:46 +0100)
hardware/common/scpi_vxi.c

index 4d713dceb9446f9fe6ff0dd4669d88072e645ab8..0377d52bb291759ecd73ce97c5dbc1db38ac0002 100644 (file)
@@ -196,12 +196,16 @@ static int scpi_vxi_close(void *priv)
        struct scpi_vxi *vxi = priv;
        Device_Error *dev_error;
 
+       if (!vxi->client)
+               return SR_ERR;
+
        if (!(dev_error = destroy_link_1(&vxi->link, vxi->client))) {
                sr_err("Link destruction failed for %s", vxi->address);
                return SR_ERR;
        }
 
        clnt_destroy(vxi->client);
+       vxi->client = NULL;
 
        return SR_OK;
 }