From: Uwe Hermann Date: Wed, 8 Mar 2017 18:47:54 +0000 (+0100) Subject: sr_scpi_free(): Allow NULL as argument. X-Git-Tag: libsigrok-0.5.0~90 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=815685462fdab21a390b5aecc253b92753439f06;p=libsigrok.git sr_scpi_free(): Allow NULL as argument. --- diff --git a/src/scpi/scpi.c b/src/scpi/scpi.c index 9ea68b57..00f4ef80 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);