X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fdevice.c;h=aa499c8d74252ad07a37cf54afbec3b1233196ce;hb=03a0002ed466eb003a984af35ba3bfc089a5ddbe;hp=38ac003cf01d7433b9c1767ccf3ace01d70329db;hpb=4bf93988023b2428129c8145ef9ea7121400f195;p=libsigrok.git diff --git a/src/device.c b/src/device.c index 38ac003c..aa499c8d 100644 --- a/src/device.c +++ b/src/device.c @@ -136,7 +136,9 @@ SR_API int sr_dev_channel_enable(struct sr_channel *channel, gboolean state) } /* Returns the next enabled channel, wrapping around if necessary. */ +/** @private */ SR_PRIV struct sr_channel *sr_next_enabled_channel(const struct sr_dev_inst *sdi, + struct sr_channel *cur_channel) { struct sr_channel *next_channel; @@ -409,7 +411,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 */ @@ -457,12 +460,16 @@ SR_PRIV struct sr_serial_dev_inst *sr_serial_dev_inst_new(const char *port, /** * Free struct sr_serial_dev_inst * allocated by sr_serial_dev_inst(). * - * @param serial The struct sr_serial_dev_inst * to free. Must not be NULL. + * @param serial The struct sr_serial_dev_inst * to free. If NULL, this + * function will do nothing. * * @private */ SR_PRIV void sr_serial_dev_inst_free(struct sr_serial_dev_inst *serial) { + if (!serial) + return; + g_free(serial->port); g_free(serial->serialcomm); g_free(serial); @@ -484,6 +491,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); }