From: Aurelien Jacobs Date: Sun, 12 Jan 2014 17:46:24 +0000 (+0100) Subject: scpi_vxi: ensure the vxi link was properly opened before closing it X-Git-Tag: libsigrok-0.3.0~309 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=dc3b3be5cb633695e700b895bc3d15deb83d722d;p=libsigrok.git scpi_vxi: ensure the vxi link was properly opened before closing it --- diff --git a/hardware/common/scpi_vxi.c b/hardware/common/scpi_vxi.c index 4d713dce..0377d52b 100644 --- a/hardware/common/scpi_vxi.c +++ b/hardware/common/scpi_vxi.c @@ -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; }