From: Uwe Hermann Date: Wed, 8 Mar 2017 18:33:18 +0000 (+0100) Subject: sr_usbtmc_dev_inst_free(): Allow NULL as argument. X-Git-Tag: libsigrok-0.5.0~92 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=ce375f2a396c4735a12e9105595d7c9f1a366abb;p=libsigrok.git sr_usbtmc_dev_inst_free(): Allow NULL as argument. --- diff --git a/src/device.c b/src/device.c index a8f6f2b4..d87d2904 100644 --- a/src/device.c +++ b/src/device.c @@ -489,6 +489,9 @@ SR_PRIV struct sr_usbtmc_dev_inst *sr_usbtmc_dev_inst_new(const char *device) /** @private */ SR_PRIV void sr_usbtmc_dev_inst_free(struct sr_usbtmc_dev_inst *usbtmc) { + if (!usbtmc) + return; + g_free(usbtmc->device); g_free(usbtmc); }