X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fdevice.c;h=d87d2904a313f74e870a370279cbd64d42110d7a;hb=176d785d33a28a1bb24f2ee483595ec54f7b52b6;hp=71221433ca0321c1ee6ca95fbab3cf335448885a;hpb=04891a997c137abb5fa423e7de7f5b9a0fd27a49;p=libsigrok.git diff --git a/src/device.c b/src/device.c index 71221433..d87d2904 100644 --- a/src/device.c +++ b/src/device.c @@ -409,7 +409,8 @@ SR_PRIV struct sr_usb_dev_inst *sr_usb_dev_inst_new(uint8_t bus, /** * Free struct sr_usb_dev_inst * allocated by sr_usb_dev_inst(). * - * @param usb The struct sr_usb_dev_inst * to free. Must not be NULL. + * @param usb The struct sr_usb_dev_inst * to free. If NULL, this + * function does nothing. * * @private */ @@ -488,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); }