]> sigrok.org Git - libsigrok.git/commitdiff
sr_scpi_free(): Allow NULL as argument.
authorUwe Hermann <redacted>
Wed, 8 Mar 2017 18:47:54 +0000 (19:47 +0100)
committerUwe Hermann <redacted>
Fri, 10 Mar 2017 10:41:34 +0000 (11:41 +0100)
src/scpi/scpi.c

index 9ea68b57316db06ad8d324cef67c41016f867227..00f4ef805eb45843dfaf502942235c040b7f0bc2 100644 (file)
@@ -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);