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

index a8f6f2b4dce9c0695961cbd1ec618f4d5f201ab3..d87d2904a313f74e870a370279cbd64d42110d7a 100644 (file)
@@ -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);
 }