sr_scpi_free(): Allow NULL as argument.
This commit is contained in:
parent
7b365c4719
commit
815685462f
|
@ -364,12 +364,14 @@ SR_PRIV int sr_scpi_close(struct sr_scpi_dev_inst *scpi)
|
||||||
/**
|
/**
|
||||||
* Free SCPI device.
|
* Free SCPI device.
|
||||||
*
|
*
|
||||||
* @param scpi Previously initialized SCPI device structure.
|
* @param scpi Previously initialized SCPI device structure. If NULL,
|
||||||
*
|
* this function does nothing.
|
||||||
* @return SR_OK on success, SR_ERR on failure.
|
|
||||||
*/
|
*/
|
||||||
SR_PRIV void sr_scpi_free(struct sr_scpi_dev_inst *scpi)
|
SR_PRIV void sr_scpi_free(struct sr_scpi_dev_inst *scpi)
|
||||||
{
|
{
|
||||||
|
if (!scpi)
|
||||||
|
return;
|
||||||
|
|
||||||
scpi->free(scpi->priv);
|
scpi->free(scpi->priv);
|
||||||
g_free(scpi->priv);
|
g_free(scpi->priv);
|
||||||
g_free(scpi);
|
g_free(scpi);
|
||||||
|
|
Loading…
Reference in New Issue