scpi_vxi: ensure the vxi link was properly opened before closing it

This commit is contained in:
Aurelien Jacobs 2014-01-12 18:46:24 +01:00
parent 104ed12553
commit dc3b3be5cb
1 changed files with 4 additions and 0 deletions

View 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;
}