summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2017-03-08 19:47:54 +0100
committerUwe Hermann <uwe@hermann-uwe.de>2017-03-10 11:41:34 +0100
commit815685462fdab21a390b5aecc253b92753439f06 (patch)
tree9c2e5aa27cf0087a6110e525a6d3f973b8197226
parent7b365c47198890da8541a6daf04697c7c7ac88d4 (diff)
sr_scpi_free(): Allow NULL as argument.
-rw-r--r--src/scpi/scpi.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/scpi/scpi.c b/src/scpi/scpi.c
index 9ea68b5..00f4ef8 100644
--- a/src/scpi/scpi.c
+++ b/src/scpi/scpi.c
@@ -364,12 +364,14 @@ SR_PRIV int sr_scpi_close(struct sr_scpi_dev_inst *scpi)
/**
* Free SCPI device.
*
- * @param scpi Previously initialized SCPI device structure.
- *
- * @return SR_OK on success, SR_ERR on failure.
+ * @param scpi Previously initialized SCPI device structure. If NULL,
+ * this function does nothing.
*/
SR_PRIV void sr_scpi_free(struct sr_scpi_dev_inst *scpi)
{
+ if (!scpi)
+ return;
+
scpi->free(scpi->priv);
g_free(scpi->priv);
g_free(scpi);